1 /*
2 # PostgreSQL Database Modeler (pgModeler)
3 #
4 # Copyright 2006-2020 - Raphael Araújo e Silva <raphael@pgmodeler.io>
5 #
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation version 3.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # The complete text of GPLv3 is at LICENSE file on source code root directory.
16 # Also, you can get the complete GNU General Public License at <http://www.gnu.org/licenses/>
17 */
18 
19 #include "constrainttype.h"
20 
21 template<>
22 QStringList ConstraintType::TemplateType<ConstraintType>::type_names =
23 {
24 	"", // Reserved for BaseType::null
25 
26 	"PRIMARY KEY",
27 	"FOREIGN KEY",
28 	"CHECK",
29 	"UNIQUE",
30 	"EXCLUDE",
31 };
32 
ConstraintType(unsigned type_id)33 ConstraintType::ConstraintType(unsigned type_id)
34 {
35 	setType(type_id);
36 }
37 
ConstraintType(const QString & type_name)38 ConstraintType::ConstraintType(const QString &type_name)
39 {
40 	setType(type_name);
41 }
42 
ConstraintType()43 ConstraintType::ConstraintType()
44 {
45 	type_idx = PrimaryKey;
46 }
47