orchid-orm 1.5.12 → 1.5.15

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.
package/dist/index.mjs CHANGED
@@ -1747,12 +1747,18 @@ const createTable = async (_a) => {
1747
1747
  const code = [
1748
1748
  `import { ${params.baseTableName} } from '${baseTablePath}';
1749
1749
  `,
1750
- `export class ${toPascalCase(ast.name)} extends ${params.baseTableName} {`,
1750
+ `export class ${toPascalCase(ast.name)}Table extends ${params.baseTableName} {`,
1751
1751
  props,
1752
1752
  "}\n"
1753
1753
  ];
1754
1754
  await fs.mkdir(path__default.dirname(tablePath), { recursive: true });
1755
- await fs.writeFile(tablePath, codeToString(code, "", " "));
1755
+ try {
1756
+ await fs.writeFile(tablePath, codeToString(code, "", " "), { flag: "wx" });
1757
+ } catch (err) {
1758
+ if (err.code !== "EEXIST") {
1759
+ throw err;
1760
+ }
1761
+ }
1756
1762
  };
1757
1763
 
1758
1764
  var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
@@ -1782,7 +1788,7 @@ const changeTable = async (_a) => {
1782
1788
  return;
1783
1789
  const changes = new FileChanges(content);
1784
1790
  const statements = ts.getStatements(content);
1785
- const className = toPascalCase(ast.name);
1791
+ const className = toPascalCase(ast.name) + "Table";
1786
1792
  for (const { t, object } of iterateColumnsShapes(statements, className)) {
1787
1793
  const context = makeChangeContext(changes, ast, content, object, t);
1788
1794
  prependSpaces(context);
@@ -2193,7 +2199,7 @@ const renameTable = async (_a) => {
2193
2199
  return;
2194
2200
  const changes = new FileChanges(content);
2195
2201
  const statements = ts.getStatements(content);
2196
- const className = toPascalCase(ast.from);
2202
+ const className = toPascalCase(ast.from) + "Table";
2197
2203
  const changeSchema = ast.fromSchema !== ast.toSchema;
2198
2204
  for (const node of ts.class.iterate(statements)) {
2199
2205
  if (((_a2 = node.name) == null ? void 0 : _a2.escapedText) !== className)