@supabase/pg-delta 1.0.0-alpha.16 → 1.0.0-alpha.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -44,6 +44,11 @@ export function diffTriggers(main, branch, branchIndexableObjects) {
44
44
  if (mainTrigger.is_partition_clone || branchTrigger.is_partition_clone) {
45
45
  continue;
46
46
  }
47
+ // Note: column_numbers is excluded because it contains pg_trigger.tgattr
48
+ // attnums that differ between databases when physical column layouts
49
+ // diverge but logical (named) columns match. The definition field
50
+ // (pg_get_triggerdef) already captures the UPDATE OF column list by name,
51
+ // so we compare by definition instead.
47
52
  const NON_ALTERABLE_FIELDS = [
48
53
  "function_schema",
49
54
  "function_name",
@@ -53,14 +58,14 @@ export function diffTriggers(main, branch, branchIndexableObjects) {
53
58
  "deferrable",
54
59
  "initially_deferred",
55
60
  "argument_count",
56
- "column_numbers",
57
61
  "arguments",
58
62
  "when_condition",
59
63
  "old_table",
60
64
  "new_table",
61
65
  "owner",
66
+ "definition", // Compare by definition instead of column_numbers (tgattr)
62
67
  ];
63
- const shouldReplace = hasNonAlterableChanges(mainTrigger, branchTrigger, NON_ALTERABLE_FIELDS, { column_numbers: deepEqual, arguments: deepEqual });
68
+ const shouldReplace = hasNonAlterableChanges(mainTrigger, branchTrigger, NON_ALTERABLE_FIELDS, { arguments: deepEqual });
64
69
  if (shouldReplace) {
65
70
  const tableStableId = stableId.table(branchTrigger.schema, branchTrigger.table_name);
66
71
  changes.push(new ReplaceTrigger({
@@ -83,7 +83,6 @@ export declare class Trigger extends BasePgModel {
83
83
  deferrable: boolean;
84
84
  initially_deferred: boolean;
85
85
  argument_count: number;
86
- column_numbers: number[] | null;
87
86
  arguments: string[];
88
87
  when_condition: string | null;
89
88
  old_table: string | null;
@@ -94,6 +93,7 @@ export declare class Trigger extends BasePgModel {
94
93
  parent_table_name: string | null;
95
94
  is_on_partitioned_table: boolean;
96
95
  owner: string;
96
+ definition: string;
97
97
  comment: string | null;
98
98
  };
99
99
  }
@@ -120,7 +120,10 @@ export class Trigger extends BasePgModel {
120
120
  deferrable: this.deferrable,
121
121
  initially_deferred: this.initially_deferred,
122
122
  argument_count: this.argument_count,
123
- column_numbers: this.column_numbers,
123
+ // column_numbers excluded: contains pg_trigger.tgattr attnums that differ
124
+ // between databases when physical column layouts diverge but logical
125
+ // (named) columns match. The definition field (pg_get_triggerdef) captures
126
+ // the UPDATE OF column list by name, so we compare by definition instead.
124
127
  arguments: this.arguments,
125
128
  when_condition: this.when_condition,
126
129
  old_table: this.old_table,
@@ -131,6 +134,7 @@ export class Trigger extends BasePgModel {
131
134
  parent_table_name: this.parent_table_name,
132
135
  is_on_partitioned_table: this.is_on_partitioned_table,
133
136
  owner: this.owner,
137
+ definition: this.definition,
134
138
  comment: this.comment,
135
139
  };
136
140
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supabase/pg-delta",
3
- "version": "1.0.0-alpha.16",
3
+ "version": "1.0.0-alpha.17",
4
4
  "description": "PostgreSQL migrations made easy",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -67,6 +67,11 @@ export function diffTriggers(
67
67
  continue;
68
68
  }
69
69
 
70
+ // Note: column_numbers is excluded because it contains pg_trigger.tgattr
71
+ // attnums that differ between databases when physical column layouts
72
+ // diverge but logical (named) columns match. The definition field
73
+ // (pg_get_triggerdef) already captures the UPDATE OF column list by name,
74
+ // so we compare by definition instead.
70
75
  const NON_ALTERABLE_FIELDS: Array<keyof Trigger> = [
71
76
  "function_schema",
72
77
  "function_name",
@@ -76,18 +81,18 @@ export function diffTriggers(
76
81
  "deferrable",
77
82
  "initially_deferred",
78
83
  "argument_count",
79
- "column_numbers",
80
84
  "arguments",
81
85
  "when_condition",
82
86
  "old_table",
83
87
  "new_table",
84
88
  "owner",
89
+ "definition", // Compare by definition instead of column_numbers (tgattr)
85
90
  ];
86
91
  const shouldReplace = hasNonAlterableChanges(
87
92
  mainTrigger,
88
93
  branchTrigger,
89
94
  NON_ALTERABLE_FIELDS,
90
- { column_numbers: deepEqual, arguments: deepEqual },
95
+ { arguments: deepEqual },
91
96
  );
92
97
  if (shouldReplace) {
93
98
  const tableStableId = stableId.table(
@@ -134,7 +134,10 @@ export class Trigger extends BasePgModel {
134
134
  deferrable: this.deferrable,
135
135
  initially_deferred: this.initially_deferred,
136
136
  argument_count: this.argument_count,
137
- column_numbers: this.column_numbers,
137
+ // column_numbers excluded: contains pg_trigger.tgattr attnums that differ
138
+ // between databases when physical column layouts diverge but logical
139
+ // (named) columns match. The definition field (pg_get_triggerdef) captures
140
+ // the UPDATE OF column list by name, so we compare by definition instead.
138
141
  arguments: this.arguments,
139
142
  when_condition: this.when_condition,
140
143
  old_table: this.old_table,
@@ -145,6 +148,7 @@ export class Trigger extends BasePgModel {
145
148
  parent_table_name: this.parent_table_name,
146
149
  is_on_partitioned_table: this.is_on_partitioned_table,
147
150
  owner: this.owner,
151
+ definition: this.definition,
148
152
  comment: this.comment,
149
153
  };
150
154
  }