File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change 7
7
-- Set defaults for non-nullable columns not included in the dump.
8
8
{{ #each tables as |table |}}
9
9
{{ #each column_defaults }}
10
- ALTER TABLE "{{ table.name }} " ALTER COLUMN "{{ @key }} " SET DEFAULT {{ this }} ;
10
+ ALTER TABLE "{{ table.name }} " ALTER COLUMN "{{ column }} " SET DEFAULT {{ value }} ;
11
11
{{ /each }}
12
12
{{ /each }}
13
13
27
27
-- Drop the defaults again.
28
28
{{ #each tables as |table |}}
29
29
{{ #each column_defaults }}
30
- ALTER TABLE "{{ table.name }} " ALTER COLUMN "{{ @key }} " DROP DEFAULT;
30
+ ALTER TABLE "{{ table.name }} " ALTER COLUMN "{{ column }} " DROP DEFAULT;
31
31
{{ /each }}
32
32
{{ /each }}
33
33
Original file line number Diff line number Diff line change 1
- use std:: { collections :: BTreeMap , fs:: File , path:: Path } ;
1
+ use std:: { fs:: File , path:: Path } ;
2
2
3
3
use crate :: tasks:: dump_db:: configuration:: { ColumnVisibility , TableConfig , VisibilityConfig } ;
4
4
use swirl:: PerformError ;
@@ -16,7 +16,13 @@ struct HandlebarsTableContext<'a> {
16
16
name : & ' a str ,
17
17
filter : Option < String > ,
18
18
columns : String ,
19
- column_defaults : BTreeMap < & ' a str , & ' a str > ,
19
+ column_defaults : Vec < ColumnDefault < ' a > > ,
20
+ }
21
+
22
+ #[ derive( Debug , Serialize ) ]
23
+ struct ColumnDefault < ' a > {
24
+ column : & ' a str ,
25
+ value : & ' a str ,
20
26
}
21
27
22
28
impl TableConfig {
@@ -35,7 +41,10 @@ impl TableConfig {
35
41
let column_defaults = self
36
42
. column_defaults
37
43
. iter ( )
38
- . map ( |( k, v) | ( k. as_str ( ) , v. as_str ( ) ) )
44
+ . map ( |( k, v) | ColumnDefault {
45
+ column : k. as_str ( ) ,
46
+ value : v. as_str ( ) ,
47
+ } )
39
48
. collect ( ) ;
40
49
Some ( HandlebarsTableContext {
41
50
name,
You can’t perform that action at this time.
0 commit comments