create-absolutejs 0.8.2 → 0.9.0

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.
Files changed (61) hide show
  1. package/LICENSE +24 -24
  2. package/README.md +179 -179
  3. package/dist/data.js +3 -0
  4. package/dist/generators/configurations/generateDrizzleConfig.js +15 -15
  5. package/dist/generators/configurations/generatePrettierrc.js +9 -9
  6. package/dist/generators/configurations/initializeRoot.js +2 -0
  7. package/dist/generators/db/dockerInitTemplates.js +79 -79
  8. package/dist/generators/db/generateDatabaseTypes.js +6 -6
  9. package/dist/generators/db/generateDockerContainer.js +19 -19
  10. package/dist/generators/db/generateDrizzleSchema.js +17 -17
  11. package/dist/generators/db/generateSqliteSchema.js +8 -8
  12. package/dist/generators/db/handlerTemplates.js +259 -259
  13. package/dist/generators/db/scaffoldDocker.js +1 -1
  14. package/dist/generators/html/generateHTMLPage.js +60 -60
  15. package/dist/generators/htmx/generateHTMXPage.js +86 -86
  16. package/dist/generators/project/generateAbsoluteAuthConfig.js +96 -96
  17. package/dist/generators/project/generateBuildBlock.d.ts +2 -1
  18. package/dist/generators/project/generateBuildBlock.js +9 -5
  19. package/dist/generators/project/generateDBBlock.js +9 -9
  20. package/dist/generators/project/generateImportsBlock.js +1 -0
  21. package/dist/generators/project/generateMarkupCSS.js +145 -145
  22. package/dist/generators/project/generateRoutesBlock.js +36 -36
  23. package/dist/generators/project/generateServer.d.ts +2 -1
  24. package/dist/generators/project/generateServer.js +29 -19
  25. package/dist/generators/project/scaffoldBackend.d.ts +2 -1
  26. package/dist/generators/project/scaffoldBackend.js +2 -1
  27. package/dist/generators/react/generateReactComponents.js +95 -95
  28. package/dist/generators/svelte/generateSveltePage.js +210 -210
  29. package/dist/generators/vue/generateVuePage.js +261 -261
  30. package/dist/messages.js +43 -43
  31. package/dist/scaffold.js +1 -0
  32. package/dist/templates/README.md +35 -35
  33. package/dist/templates/assets/svg/google-logo.svg +7 -7
  34. package/dist/templates/assets/svg/htmx-logo-black.svg +9 -9
  35. package/dist/templates/assets/svg/htmx-logo-white.svg +9 -9
  36. package/dist/templates/assets/svg/vue-logo.svg +4 -4
  37. package/dist/templates/configurations/.prettierignore +3 -3
  38. package/dist/templates/configurations/.prettierrc.json +9 -9
  39. package/dist/templates/configurations/drizzle.config.ts +13 -13
  40. package/dist/templates/configurations/eslint.config.mjs +243 -243
  41. package/dist/templates/configurations/tsconfig.example.json +98 -98
  42. package/dist/templates/constants.ts +2 -2
  43. package/dist/templates/db/docker-compose.db.yml +15 -15
  44. package/dist/templates/git/gitignore +51 -51
  45. package/dist/templates/html/scripts/typescript-example.ts +21 -21
  46. package/dist/templates/react/components/App.tsx +52 -52
  47. package/dist/templates/react/components/Head.tsx +34 -34
  48. package/dist/templates/react/components/OAuthLink.tsx +39 -39
  49. package/dist/templates/react/components/ProfilePicture.tsx +56 -56
  50. package/dist/templates/styles/colors.ts +11 -11
  51. package/dist/templates/styles/reset.css +84 -84
  52. package/dist/templates/svelte/components/Counter.svelte +19 -19
  53. package/dist/templates/svelte/composables/counter.svelte.ts +14 -14
  54. package/dist/templates/tailwind/postcss.config.ts +8 -8
  55. package/dist/templates/tailwind/tailwind.config.ts +7 -7
  56. package/dist/templates/tailwind/tailwind.css +1 -1
  57. package/dist/templates/vue/components/CountButton.vue +39 -39
  58. package/dist/templates/vue/composables/useCount.ts +14 -14
  59. package/dist/versions.d.ts +1 -1
  60. package/dist/versions.js +1 -1
  61. package/package.json +1 -1
package/LICENSE CHANGED
@@ -1,24 +1,24 @@
1
- ```
2
- # Creative Commons Attribution-NonCommercial 4.0 International License (CC BY-NC 4.0)
3
-
4
- By using this project, you agree to the following terms under the Creative Commons Attribution-NonCommercial 4.0 International License.
5
-
6
- ## License Summary
7
- This license allows you to:
8
- - **Share**: Copy and redistribute the material in any medium or format.
9
- - **Adapt**: Remix, transform, and build upon the material.
10
-
11
- **Under the following conditions**:
12
- - **Attribution**: You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
13
- - **Non-Commercial**: You may not use the material for commercial purposes.
14
-
15
- ## Full License Text
16
- The full license text can be found at: https://creativecommons.org/licenses/by-nc/4.0/legalcode
17
-
18
- ## Contact Information for Commercial Use
19
- For commercial use, licensing inquiries, or additional permissions, please contact:
20
- Alex Kahn
21
- alexkahndev@gmail.com
22
- alexkahndev.github.io
23
- ```
24
-
1
+ ```
2
+ # Creative Commons Attribution-NonCommercial 4.0 International License (CC BY-NC 4.0)
3
+
4
+ By using this project, you agree to the following terms under the Creative Commons Attribution-NonCommercial 4.0 International License.
5
+
6
+ ## License Summary
7
+ This license allows you to:
8
+ - **Share**: Copy and redistribute the material in any medium or format.
9
+ - **Adapt**: Remix, transform, and build upon the material.
10
+
11
+ **Under the following conditions**:
12
+ - **Attribution**: You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
13
+ - **Non-Commercial**: You may not use the material for commercial purposes.
14
+
15
+ ## Full License Text
16
+ The full license text can be found at: https://creativecommons.org/licenses/by-nc/4.0/legalcode
17
+
18
+ ## Contact Information for Commercial Use
19
+ For commercial use, licensing inquiries, or additional permissions, please contact:
20
+ Alex Kahn
21
+ alexkahndev@gmail.com
22
+ alexkahndev.github.io
23
+ ```
24
+
package/README.md CHANGED
@@ -1,179 +1,179 @@
1
- # create-absolutejs
2
-
3
- A CLI tool to scaffold new AbsoluteJS projects quickly and effortlessly.
4
-
5
- ## Usage
6
-
7
- Scaffold a new project called `<project-name>`:
8
-
9
- ```bash
10
- bun create absolutejs my-app
11
- ```
12
-
13
- Alternatively, using npm, Yarn, or pnpm:
14
-
15
- ```bash
16
- npm create absolutejs my-app
17
- yarn create absolutejs my-app
18
- pnpm create absolutejs my-app
19
- ```
20
-
21
- By default, the CLI will interactively prompt you for any missing configuration values. You can also supply flags to skip those prompts:
22
-
23
- - To skip **all** optional prompts and use `none` for every optional configuration:
24
- ```bash
25
- bun create absolutejs my-app --skip
26
- ```
27
- - To skip **one** optional prompt without providing a real value, pass `none` to that flag:
28
- ```bash
29
- bun create absolutejs my-app --auth none --engine none
30
- ```
31
-
32
- ## Options
33
-
34
- ```text
35
- Usage: create-absolute [project-name] [options]
36
- ```
37
-
38
- ### Arguments
39
-
40
- - `project-name`
41
- Name of the application to create. If omitted, you'll be prompted to enter one.
42
-
43
- ### Options
44
-
45
- - `--help`, `-h`
46
- Show this help message and exit.
47
-
48
- - `--debug`, `-d`
49
- Display a summary of the project configuration after creation.
50
-
51
- - `--angular`
52
- Include an Angular frontend.
53
-
54
- - `--angular-dir <directory>`
55
- Specify the directory for and use the Angular frontend.
56
-
57
- - `--assets <directory>`
58
- Directory name for your static assets.
59
-
60
- - `--auth <plugin|none>`
61
- Pre-configured auth plugin (currently only `absolute-auth`) or `none`.
62
-
63
- - `--biome`
64
- Use Biome for code quality and formatting.
65
-
66
- - `--build <direrctory>`
67
- Output directory for build artifacts.
68
-
69
- - `--db <engine|none>`
70
- Database engine (`postgresql` | `mysql` | `sqlite` | `mongodb` | `redis` | `singlestore` | `cockroachdb` | `mssql`) or `none`.
71
-
72
- - `--db-dir <directory>`
73
- Directory name for your database files.
74
-
75
- - `--db-host <provider|none>`
76
- Database host provider (`neon` | `planetscale` | `supabase` | `turso` | `vercel` | `upstash` | `atlas`) or `none`.
77
-
78
- - `--directory <default|custom>`
79
- Directory-naming strategy: `default` or `custom`.
80
-
81
- - `--eslint+prettier`
82
- Use ESLint + Prettier for code quality and formatting.
83
-
84
- - `--git`
85
- Initialize a Git repository.
86
-
87
- - `--html`
88
- Include a plain HTML frontend.
89
-
90
- - `--html-dir <directory>`
91
- Specify the directory for and use the HTML frontend.
92
-
93
- - `--html-scripts`
94
- Enable HTML scripting with TypeScript.
95
-
96
- - `--htmx`
97
- Include an HTMX frontend.
98
-
99
- - `--htmx-dir <directory>`
100
- Specify the directory for and use the HTMX frontend.
101
-
102
- - `--install`
103
- Use the same package manager to install dependencies.
104
-
105
- - `--lts`
106
- Use LTS versions of required packages.
107
-
108
- - `--orm <drizzle|prisma|none>`
109
- ORM to configure: `drizzle` | `prisma` | `none`.
110
-
111
- - `--plugin <plugin>`
112
- Elysia plugin(s) to include (repeatable); `none` skips plugin setup.
113
-
114
- - `--react`
115
- Include a React frontend.
116
-
117
- - `--react-dir <directory>`
118
- Specify the directory for and use the React frontend.
119
-
120
- - `--skip`
121
- Skip non-required prompts; uses `none` for all optional configs.
122
-
123
- - `--svelte`
124
- Include a Svelte frontend.
125
-
126
- - `--svelte-dir <directory>`
127
- Specify the directory for and use the Svelte frontend.
128
-
129
- - `--tailwind`
130
- Include Tailwind CSS setup.
131
-
132
- - `--tailwind-input <file>`
133
- Path to your Tailwind CSS entry file.
134
-
135
- - `--tailwind-output <file>`
136
- Path for the generated Tailwind CSS bundle.
137
-
138
- - `--vue`
139
- Include a Vue frontend.
140
-
141
- - `--vue-dir <directory>`
142
- Specify the directory for and use the Vue frontend.
143
-
144
- ## Directory Configuration
145
-
146
- Choose between the **default** layout (pre-configured folder names) or **custom**, which prompts you to specify each directory name yourself:
147
-
148
- ```bash
149
- bun create absolutejs my-app --directory custom
150
- ```
151
-
152
- ## Debug & LTS Flags
153
-
154
- - `--debug`, `-d`
155
- After scaffolding, prints a detailed summary of your configuration (language, frontends, directories, etc.).
156
- - `--lts`
157
- Instructs the CLI to fetch and pin the latest published versions of your dependencies instead of its default pinned versions.
158
-
159
- ## Getting Started
160
-
161
- Once the scaffold completes, you’re ready to go:
162
-
163
- ```bash
164
- cd my-app
165
- # (If you skipped automated install)
166
- bun install
167
- # Then start the dev server
168
- bun run dev
169
- ```
170
-
171
- If you downloaded this repository to test or make changes you can use `bun run test` to start the created dev server without having to change directories back and forth.
172
-
173
- ## Contributing
174
-
175
- Contributions are welcome! Feel free to open issues or submit pull requests to improve the CLI.
176
-
177
- ## License
178
-
179
- Licensed under CC BY-NC 4.0.
1
+ # create-absolutejs
2
+
3
+ A CLI tool to scaffold new AbsoluteJS projects quickly and effortlessly.
4
+
5
+ ## Usage
6
+
7
+ Scaffold a new project called `<project-name>`:
8
+
9
+ ```bash
10
+ bun create absolutejs my-app
11
+ ```
12
+
13
+ Alternatively, using npm, Yarn, or pnpm:
14
+
15
+ ```bash
16
+ npm create absolutejs my-app
17
+ yarn create absolutejs my-app
18
+ pnpm create absolutejs my-app
19
+ ```
20
+
21
+ By default, the CLI will interactively prompt you for any missing configuration values. You can also supply flags to skip those prompts:
22
+
23
+ - To skip **all** optional prompts and use `none` for every optional configuration:
24
+ ```bash
25
+ bun create absolutejs my-app --skip
26
+ ```
27
+ - To skip **one** optional prompt without providing a real value, pass `none` to that flag:
28
+ ```bash
29
+ bun create absolutejs my-app --auth none --engine none
30
+ ```
31
+
32
+ ## Options
33
+
34
+ ```text
35
+ Usage: create-absolute [project-name] [options]
36
+ ```
37
+
38
+ ### Arguments
39
+
40
+ - `project-name`
41
+ Name of the application to create. If omitted, you'll be prompted to enter one.
42
+
43
+ ### Options
44
+
45
+ - `--help`, `-h`
46
+ Show this help message and exit.
47
+
48
+ - `--debug`, `-d`
49
+ Display a summary of the project configuration after creation.
50
+
51
+ - `--angular`
52
+ Include an Angular frontend.
53
+
54
+ - `--angular-dir <directory>`
55
+ Specify the directory for and use the Angular frontend.
56
+
57
+ - `--assets <directory>`
58
+ Directory name for your static assets.
59
+
60
+ - `--auth <plugin|none>`
61
+ Pre-configured auth plugin (currently only `absolute-auth`) or `none`.
62
+
63
+ - `--biome`
64
+ Use Biome for code quality and formatting.
65
+
66
+ - `--build <direrctory>`
67
+ Output directory for build artifacts.
68
+
69
+ - `--db <engine|none>`
70
+ Database engine (`postgresql` | `mysql` | `sqlite` | `mongodb` | `redis` | `singlestore` | `cockroachdb` | `mssql`) or `none`.
71
+
72
+ - `--db-dir <directory>`
73
+ Directory name for your database files.
74
+
75
+ - `--db-host <provider|none>`
76
+ Database host provider (`neon` | `planetscale` | `supabase` | `turso` | `vercel` | `upstash` | `atlas`) or `none`.
77
+
78
+ - `--directory <default|custom>`
79
+ Directory-naming strategy: `default` or `custom`.
80
+
81
+ - `--eslint+prettier`
82
+ Use ESLint + Prettier for code quality and formatting.
83
+
84
+ - `--git`
85
+ Initialize a Git repository.
86
+
87
+ - `--html`
88
+ Include a plain HTML frontend.
89
+
90
+ - `--html-dir <directory>`
91
+ Specify the directory for and use the HTML frontend.
92
+
93
+ - `--html-scripts`
94
+ Enable HTML scripting with TypeScript.
95
+
96
+ - `--htmx`
97
+ Include an HTMX frontend.
98
+
99
+ - `--htmx-dir <directory>`
100
+ Specify the directory for and use the HTMX frontend.
101
+
102
+ - `--install`
103
+ Use the same package manager to install dependencies.
104
+
105
+ - `--lts`
106
+ Use LTS versions of required packages.
107
+
108
+ - `--orm <drizzle|prisma|none>`
109
+ ORM to configure: `drizzle` | `prisma` | `none`.
110
+
111
+ - `--plugin <plugin>`
112
+ Elysia plugin(s) to include (repeatable); `none` skips plugin setup.
113
+
114
+ - `--react`
115
+ Include a React frontend.
116
+
117
+ - `--react-dir <directory>`
118
+ Specify the directory for and use the React frontend.
119
+
120
+ - `--skip`
121
+ Skip non-required prompts; uses `none` for all optional configs.
122
+
123
+ - `--svelte`
124
+ Include a Svelte frontend.
125
+
126
+ - `--svelte-dir <directory>`
127
+ Specify the directory for and use the Svelte frontend.
128
+
129
+ - `--tailwind`
130
+ Include Tailwind CSS setup.
131
+
132
+ - `--tailwind-input <file>`
133
+ Path to your Tailwind CSS entry file.
134
+
135
+ - `--tailwind-output <file>`
136
+ Path for the generated Tailwind CSS bundle.
137
+
138
+ - `--vue`
139
+ Include a Vue frontend.
140
+
141
+ - `--vue-dir <directory>`
142
+ Specify the directory for and use the Vue frontend.
143
+
144
+ ## Directory Configuration
145
+
146
+ Choose between the **default** layout (pre-configured folder names) or **custom**, which prompts you to specify each directory name yourself:
147
+
148
+ ```bash
149
+ bun create absolutejs my-app --directory custom
150
+ ```
151
+
152
+ ## Debug & LTS Flags
153
+
154
+ - `--debug`, `-d`
155
+ After scaffolding, prints a detailed summary of your configuration (language, frontends, directories, etc.).
156
+ - `--lts`
157
+ Instructs the CLI to fetch and pin the latest published versions of your dependencies instead of its default pinned versions.
158
+
159
+ ## Getting Started
160
+
161
+ Once the scaffold completes, you’re ready to go:
162
+
163
+ ```bash
164
+ cd my-app
165
+ # (If you skipped automated install)
166
+ bun install
167
+ # Then start the dev server
168
+ bun run dev
169
+ ```
170
+
171
+ If you downloaded this repository to test or make changes you can use `bun run test` to start the created dev server without having to change directories back and forth.
172
+
173
+ ## Contributing
174
+
175
+ Contributions are welcome! Feel free to open issues or submit pull requests to improve the CLI.
176
+
177
+ ## License
178
+
179
+ Licensed under CC BY-NC 4.0.
package/dist/data.js CHANGED
@@ -167,8 +167,11 @@ export const defaultDependencies = [
167
167
  export const defaultPlugins = [
168
168
  {
169
169
  imports: [
170
+ { isPlugin: false, packageName: 'BuildConfig' },
170
171
  { isPlugin: false, packageName: 'asset' },
171
172
  { isPlugin: false, packageName: 'build' },
173
+ { isPlugin: false, packageName: 'devBuild' },
174
+ { isPlugin: false, packageName: 'hmr' },
172
175
  { isPlugin: true, packageName: 'networking' }
173
176
  ],
174
177
  latestVersion: versions['@absolutejs/absolute'],
@@ -1,21 +1,21 @@
1
1
  import { writeFileSync } from 'fs';
2
2
  import { join } from 'path';
3
3
  export const createDrizzleConfig = ({ projectName, databaseDirectory, databaseEngine }) => {
4
- const drizzleConfig = `import { defineConfig } from "drizzle-kit";
5
- import { env } from 'process';
6
-
7
- if (!env.DATABASE_URL) {
8
- throw new Error('DATABASE_URL must be set in the environment variables');
9
- }
10
-
11
- export default defineConfig({
12
- dbCredentials: {
13
- url: env.DATABASE_URL
14
- },
15
- dialect: '${databaseEngine}',
16
- out: '${databaseDirectory}/migrations',
17
- schema: '${databaseDirectory}/schema.ts'
18
- });
4
+ const drizzleConfig = `import { defineConfig } from "drizzle-kit";
5
+ import { env } from 'process';
6
+
7
+ if (!env.DATABASE_URL) {
8
+ throw new Error('DATABASE_URL must be set in the environment variables');
9
+ }
10
+
11
+ export default defineConfig({
12
+ dbCredentials: {
13
+ url: env.DATABASE_URL
14
+ },
15
+ dialect: '${databaseEngine}',
16
+ out: '${databaseDirectory}/migrations',
17
+ schema: '${databaseDirectory}/schema.ts'
18
+ });
19
19
  `;
20
20
  writeFileSync(join(projectName, 'drizzle.config.ts'), drizzleConfig);
21
21
  };
@@ -1,13 +1,13 @@
1
1
  export const generatePrettierrc = (frontends) => {
2
2
  const usesSvelte = frontends.some((frontend) => frontend === 'svelte');
3
- return `{
4
- "endOfLine": "auto",
5
- "printWidth": 80,
6
- "semi": true,
7
- "singleQuote": true,
8
- "tabWidth": 4,
9
- "trailingComma": "none",
10
- "useTabs": true
11
- ${usesSvelte ? `,"plugins": ["prettier-plugin-svelte"],\n"overrides": [{"files": "*.svelte", "options": {"parser": "svelte"}}]` : ''}
3
+ return `{
4
+ "endOfLine": "auto",
5
+ "printWidth": 80,
6
+ "semi": true,
7
+ "singleQuote": true,
8
+ "tabWidth": 4,
9
+ "trailingComma": "none",
10
+ "useTabs": true
11
+ ${usesSvelte ? `,"plugins": ["prettier-plugin-svelte"],\n"overrides": [{"files": "*.svelte", "options": {"parser": "svelte"}}]` : ''}
12
12
  }`;
13
13
  };
@@ -14,8 +14,10 @@ export const initalizeRoot = (projectName, templatesDirectory) => {
14
14
  copyFileSync(constantsSrc, constantsDest);
15
15
  const frontendDirectory = join(srcDir, 'frontend');
16
16
  const backendDirectory = join(srcDir, 'backend');
17
+ const publicDirectory = join(projectName, 'public');
17
18
  mkdirSync(frontendDirectory);
18
19
  mkdirSync(backendDirectory);
20
+ mkdirSync(publicDirectory);
19
21
  const projectAssetsDirectory = join(backendDirectory, 'assets');
20
22
  mkdirSync(projectAssetsDirectory);
21
23
  mkdirSync(join(projectAssetsDirectory, 'ico'), { recursive: true });
@@ -1,95 +1,95 @@
1
- const postgresqlUsers = `CREATE TABLE IF NOT EXISTS users (
2
- auth_sub VARCHAR(255) PRIMARY KEY,
3
- created_at TIMESTAMP NOT NULL DEFAULT NOW(),
4
- metadata JSONB DEFAULT '{}'::jsonb
1
+ const postgresqlUsers = `CREATE TABLE IF NOT EXISTS users (
2
+ auth_sub VARCHAR(255) PRIMARY KEY,
3
+ created_at TIMESTAMP NOT NULL DEFAULT NOW(),
4
+ metadata JSONB DEFAULT '{}'::jsonb
5
5
  );`;
6
- const postgresqlCountHistory = `CREATE TABLE IF NOT EXISTS count_history (
7
- uid INTEGER PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
8
- count INTEGER NOT NULL,
9
- created_at TIMESTAMP NOT NULL DEFAULT NOW()
6
+ const postgresqlCountHistory = `CREATE TABLE IF NOT EXISTS count_history (
7
+ uid INTEGER PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
8
+ count INTEGER NOT NULL,
9
+ created_at TIMESTAMP NOT NULL DEFAULT NOW()
10
10
  );`;
11
- const mysqlUsers = `CREATE TABLE IF NOT EXISTS users (
12
- auth_sub VARCHAR(255) PRIMARY KEY,
13
- created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
14
- metadata JSON DEFAULT (JSON_OBJECT())
11
+ const mysqlUsers = `CREATE TABLE IF NOT EXISTS users (
12
+ auth_sub VARCHAR(255) PRIMARY KEY,
13
+ created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
14
+ metadata JSON DEFAULT (JSON_OBJECT())
15
15
  );`;
16
- const mysqlCountHistory = `CREATE TABLE IF NOT EXISTS count_history (
17
- uid INT AUTO_INCREMENT PRIMARY KEY,
18
- count INT NOT NULL,
19
- created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
16
+ const mysqlCountHistory = `CREATE TABLE IF NOT EXISTS count_history (
17
+ uid INT AUTO_INCREMENT PRIMARY KEY,
18
+ count INT NOT NULL,
19
+ created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
20
20
  );`;
21
- const mariadbUsers = `CREATE TABLE IF NOT EXISTS users (
22
- auth_sub VARCHAR(255) PRIMARY KEY,
23
- created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
24
- metadata JSON DEFAULT ('{}')
21
+ const mariadbUsers = `CREATE TABLE IF NOT EXISTS users (
22
+ auth_sub VARCHAR(255) PRIMARY KEY,
23
+ created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
24
+ metadata JSON DEFAULT ('{}')
25
25
  );`;
26
- const mariadbCountHistory = `CREATE TABLE IF NOT EXISTS count_history (
27
- uid INT AUTO_INCREMENT PRIMARY KEY,
28
- count INT NOT NULL,
29
- created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
26
+ const mariadbCountHistory = `CREATE TABLE IF NOT EXISTS count_history (
27
+ uid INT AUTO_INCREMENT PRIMARY KEY,
28
+ count INT NOT NULL,
29
+ created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
30
30
  );`;
31
- const singlestoreUsers = `CREATE TABLE IF NOT EXISTS users (
32
- auth_sub VARCHAR(255) PRIMARY KEY,
33
- created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
34
- metadata JSON DEFAULT ('{}')
31
+ const singlestoreUsers = `CREATE TABLE IF NOT EXISTS users (
32
+ auth_sub VARCHAR(255) PRIMARY KEY,
33
+ created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
34
+ metadata JSON DEFAULT ('{}')
35
35
  );`;
36
- const singlestoreCountHistory = `CREATE TABLE IF NOT EXISTS count_history (
37
- uid INT AUTO_INCREMENT PRIMARY KEY,
38
- count INT NOT NULL,
39
- created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
36
+ const singlestoreCountHistory = `CREATE TABLE IF NOT EXISTS count_history (
37
+ uid INT AUTO_INCREMENT PRIMARY KEY,
38
+ count INT NOT NULL,
39
+ created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
40
40
  );`;
41
- const cockroachdbUsers = `CREATE TABLE IF NOT EXISTS users (
42
- auth_sub VARCHAR(255) PRIMARY KEY,
43
- created_at TIMESTAMP NOT NULL DEFAULT NOW(),
44
- metadata JSONB DEFAULT '{}'::jsonb
41
+ const cockroachdbUsers = `CREATE TABLE IF NOT EXISTS users (
42
+ auth_sub VARCHAR(255) PRIMARY KEY,
43
+ created_at TIMESTAMP NOT NULL DEFAULT NOW(),
44
+ metadata JSONB DEFAULT '{}'::jsonb
45
45
  );`;
46
- const cockroachdbCountHistory = `CREATE SEQUENCE IF NOT EXISTS count_history_uid_seq START WITH 1 INCREMENT BY 1;
47
- CREATE TABLE IF NOT EXISTS count_history (
48
- uid BIGINT PRIMARY KEY DEFAULT nextval('count_history_uid_seq'),
49
- count INT NOT NULL,
50
- created_at TIMESTAMP NOT NULL DEFAULT NOW()
46
+ const cockroachdbCountHistory = `CREATE SEQUENCE IF NOT EXISTS count_history_uid_seq START WITH 1 INCREMENT BY 1;
47
+ CREATE TABLE IF NOT EXISTS count_history (
48
+ uid BIGINT PRIMARY KEY DEFAULT nextval('count_history_uid_seq'),
49
+ count INT NOT NULL,
50
+ created_at TIMESTAMP NOT NULL DEFAULT NOW()
51
51
  );`;
52
- const mssqlUsers = `IF OBJECT_ID('users','U') IS NULL
53
- BEGIN
54
- CREATE TABLE users (
55
- auth_sub NVARCHAR(255) PRIMARY KEY,
56
- created_at DATETIME2 NOT NULL DEFAULT SYSUTCDATETIME(),
57
- metadata NVARCHAR(MAX) NULL
58
- );
52
+ const mssqlUsers = `IF OBJECT_ID('users','U') IS NULL
53
+ BEGIN
54
+ CREATE TABLE users (
55
+ auth_sub NVARCHAR(255) PRIMARY KEY,
56
+ created_at DATETIME2 NOT NULL DEFAULT SYSUTCDATETIME(),
57
+ metadata NVARCHAR(MAX) NULL
58
+ );
59
59
  END;`;
60
- const mssqlCountHistory = `IF OBJECT_ID('count_history','U') IS NULL
61
- BEGIN
62
- CREATE TABLE count_history (
63
- uid INT IDENTITY(1,1) PRIMARY KEY,
64
- count INT NOT NULL,
65
- created_at DATETIME2 NOT NULL DEFAULT SYSUTCDATETIME()
66
- );
60
+ const mssqlCountHistory = `IF OBJECT_ID('count_history','U') IS NULL
61
+ BEGIN
62
+ CREATE TABLE count_history (
63
+ uid INT IDENTITY(1,1) PRIMARY KEY,
64
+ count INT NOT NULL,
65
+ created_at DATETIME2 NOT NULL DEFAULT SYSUTCDATETIME()
66
+ );
67
67
  END;`;
68
- const gelUsers = `create type users {
69
- create required property auth_sub: str {
70
- create constraint exclusive;
71
- };
72
-
73
- create required property created_at: datetime {
74
- set default := datetime_current();
75
- };
76
-
77
- create required property metadata: json {
78
- set default := to_json('{}');
79
- };
68
+ const gelUsers = `create type users {
69
+ create required property auth_sub: str {
70
+ create constraint exclusive;
71
+ };
72
+
73
+ create required property created_at: datetime {
74
+ set default := datetime_current();
75
+ };
76
+
77
+ create required property metadata: json {
78
+ set default := to_json('{}');
79
+ };
80
80
  };`;
81
- const gelCountHistory = `create scalar type CountHistoryUid extending sequence;
82
- create type count_history {
83
- create required property uid: CountHistoryUid {
84
- create constraint exclusive;
85
- set default := sequence_next(introspect CountHistoryUid);
86
- };
87
-
88
- create required property count: int16;
89
-
90
- create required property created_at: datetime {
91
- set default := datetime_current();
92
- };
81
+ const gelCountHistory = `create scalar type CountHistoryUid extending sequence;
82
+ create type count_history {
83
+ create required property uid: CountHistoryUid {
84
+ create constraint exclusive;
85
+ set default := sequence_next(introspect CountHistoryUid);
86
+ };
87
+
88
+ create required property count: int16;
89
+
90
+ create required property created_at: datetime {
91
+ set default := datetime_current();
92
+ };
93
93
  };`;
94
94
  export const userTables = {
95
95
  cockroachdb: cockroachdbUsers,