Skip to content

Commit f6b678a

Browse files
DominicGBauerDominicGBauer
andauthored
chore: change TableV2 to Table (#78)
Co-authored-by: DominicGBauer <dominic@nomanini.com>
1 parent 3210fe7 commit f6b678a

File tree

5 files changed

+398
-27
lines changed

5 files changed

+398
-27
lines changed

.changeset/shiny-bees-heal.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@powersync/service-sync-rules': patch
3+
---
4+
5+
Change TableV2 to Table in schema generator

packages/sync-rules/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"yaml": "^2.3.1"
2727
},
2828
"devDependencies": {
29-
"@types/node": "18.11.11",
30-
"vitest": "^0.34.6"
29+
"@types/node": "18.19.50",
30+
"vitest": "^2.0.5"
3131
}
3232
}

packages/sync-rules/src/TsSchemaGenerator.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,17 @@ ${this.generateTypeExports()}`;
7272
private generateImports() {
7373
const importStyle = this.options.imports ?? 'auto';
7474
if (importStyle == TsSchemaImports.web) {
75-
return `import { column, Schema, TableV2 } from '@powersync/web';`;
75+
return `import { column, Schema, Table } from '@powersync/web';`;
7676
} else if (importStyle == TsSchemaImports.reactNative) {
77-
return `import { column, Schema, TableV2 } from '@powersync/react-native';`;
77+
return `import { column, Schema, Table } from '@powersync/react-native';`;
7878
} else {
79-
return `import { column, Schema, TableV2 } from '@powersync/web';
80-
// OR: import { column, Schema, TableV2 } from '@powersync/react-native';`;
79+
return `import { column, Schema, Table } from '@powersync/web';
80+
// OR: import { column, Schema, Table } from '@powersync/react-native';`;
8181
}
8282
}
8383

8484
private generateTable(name: string, columns: ColumnDefinition[]): string {
85-
return `const ${name} = new TableV2(
85+
return `const ${name} = new Table(
8686
{
8787
// id column (text) is automatically included
8888
${columns.map((c) => this.generateColumn(c)).join(',\n ')}

packages/sync-rules/test/src/sync_rules.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -785,10 +785,10 @@ bucket_definitions:
785785
`);
786786

787787
expect(new TsSchemaGenerator().generate(rules, schema)).toEqual(
788-
`import { column, Schema, TableV2 } from '@powersync/web';
789-
// OR: import { column, Schema, TableV2 } from '@powersync/react-native';
788+
`import { column, Schema, Table } from '@powersync/web';
789+
// OR: import { column, Schema, Table } from '@powersync/react-native';
790790
791-
const assets1 = new TableV2(
791+
const assets1 = new Table(
792792
{
793793
// id column (text) is automatically included
794794
name: column.text,
@@ -798,7 +798,7 @@ const assets1 = new TableV2(
798798
{ indexes: {} }
799799
);
800800
801-
const assets2 = new TableV2(
801+
const assets2 = new Table(
802802
{
803803
// id column (text) is automatically included
804804
name: column.text,

0 commit comments

Comments
 (0)