File: column.sch

package info (click to toggle)
pgmodeler 1.2.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 14,160 kB
  • sloc: cpp: 99,216; xml: 27; sh: 15; makefile: 6
file content (83 lines) | stat: -rw-r--r-- 1,386 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# SQL definition for columns
# CAUTION: Do not modify this file unless you know what you are doing.
# Code generation can be broken if incorrect changes are made.

@include "ddlend"

%if {decl-in-table} %then
	$tb
%else
	[-- object: ] {name} [ | type: ] {sql-object} [ --] $br

	%if {table} %then
		[ALTER TABLE ] {table} [ ADD COLUMN ]
	%end
%end

{name} $sp {type}

%if {collation} %then
	[ COLLATE ]  {collation}
%end

%if {not-null} %then
	[ NOT NULL]
%end

%if {identity-type} %then
	[ GENERATED ] {identity-type} [ AS IDENTITY ]

	%if {increment} %or {min-value} %or {max-value} %or {start} %or {cache} %or {cycle} %then
		[(]
	%end

	%if {increment} %then
		[ INCREMENT BY ] {increment}
	%end

	%if {min-value} %then
		[ MINVALUE ] {min-value}
	%end

	%if {max-value} %then
		[ MAXVALUE ] {max-value}
	%end

	%if {start} %then
		[ START WITH ] {start}
	%end

	%if {cache} %then
		[ CACHE ] {cache}
	%end

	%if {cycle} %then
		[ CYCLE]
	%end

	%if {increment} %or {min-value} %or {max-value} %or {start} %or {cache} %or {cycle} %then
		[ )]
	%end
%else
	%if ({pgsql-ver} >=f "12.0") %and {generated} %then
		[ GENERATED ALWAYS AS (] {default-value} [) STORED]
	%else
		%if {default-value} %then
			[ DEFAULT ] {default-value}
		%end
	%end
%end

%if {decl-in-table} %then
	[,]
%else
	[;]

	{ddl-end} $br
%end

%if %not {decl-in-table} %and {comment} %then
	{comment} $br
%end

$br