@rebasepro/server-postgresql 0.0.1-canary.09e5ec5

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 (196) hide show
  1. package/LICENSE +6 -0
  2. package/README.md +106 -0
  3. package/build-errors.txt +37 -0
  4. package/dist/common/src/collections/CollectionRegistry.d.ts +56 -0
  5. package/dist/common/src/collections/index.d.ts +1 -0
  6. package/dist/common/src/data/buildRebaseData.d.ts +14 -0
  7. package/dist/common/src/index.d.ts +3 -0
  8. package/dist/common/src/util/builders.d.ts +57 -0
  9. package/dist/common/src/util/callbacks.d.ts +6 -0
  10. package/dist/common/src/util/collections.d.ts +11 -0
  11. package/dist/common/src/util/common.d.ts +2 -0
  12. package/dist/common/src/util/conditions.d.ts +26 -0
  13. package/dist/common/src/util/entities.d.ts +58 -0
  14. package/dist/common/src/util/enums.d.ts +3 -0
  15. package/dist/common/src/util/index.d.ts +16 -0
  16. package/dist/common/src/util/navigation_from_path.d.ts +34 -0
  17. package/dist/common/src/util/navigation_utils.d.ts +20 -0
  18. package/dist/common/src/util/parent_references_from_path.d.ts +6 -0
  19. package/dist/common/src/util/paths.d.ts +14 -0
  20. package/dist/common/src/util/permissions.d.ts +5 -0
  21. package/dist/common/src/util/references.d.ts +2 -0
  22. package/dist/common/src/util/relations.d.ts +22 -0
  23. package/dist/common/src/util/resolutions.d.ts +72 -0
  24. package/dist/common/src/util/storage.d.ts +24 -0
  25. package/dist/index.es.js +11298 -0
  26. package/dist/index.es.js.map +1 -0
  27. package/dist/index.umd.js +11306 -0
  28. package/dist/index.umd.js.map +1 -0
  29. package/dist/server-postgresql/src/PostgresBackendDriver.d.ts +100 -0
  30. package/dist/server-postgresql/src/PostgresBootstrapper.d.ts +40 -0
  31. package/dist/server-postgresql/src/auth/ensure-tables.d.ts +6 -0
  32. package/dist/server-postgresql/src/auth/services.d.ts +192 -0
  33. package/dist/server-postgresql/src/cli.d.ts +1 -0
  34. package/dist/server-postgresql/src/collections/PostgresCollectionRegistry.d.ts +43 -0
  35. package/dist/server-postgresql/src/connection.d.ts +40 -0
  36. package/dist/server-postgresql/src/data-transformer.d.ts +58 -0
  37. package/dist/server-postgresql/src/databasePoolManager.d.ts +20 -0
  38. package/dist/server-postgresql/src/history/HistoryService.d.ts +71 -0
  39. package/dist/server-postgresql/src/history/ensure-history-table.d.ts +7 -0
  40. package/dist/server-postgresql/src/index.d.ts +13 -0
  41. package/dist/server-postgresql/src/interfaces.d.ts +18 -0
  42. package/dist/server-postgresql/src/schema/auth-schema.d.ts +868 -0
  43. package/dist/server-postgresql/src/schema/doctor-cli.d.ts +2 -0
  44. package/dist/server-postgresql/src/schema/doctor.d.ts +43 -0
  45. package/dist/server-postgresql/src/schema/generate-drizzle-schema-logic.d.ts +2 -0
  46. package/dist/server-postgresql/src/schema/generate-drizzle-schema.d.ts +1 -0
  47. package/dist/server-postgresql/src/schema/introspect-db-logic.d.ts +82 -0
  48. package/dist/server-postgresql/src/schema/introspect-db.d.ts +1 -0
  49. package/dist/server-postgresql/src/schema/test-schema.d.ts +24 -0
  50. package/dist/server-postgresql/src/services/BranchService.d.ts +47 -0
  51. package/dist/server-postgresql/src/services/EntityFetchService.d.ts +209 -0
  52. package/dist/server-postgresql/src/services/EntityPersistService.d.ts +41 -0
  53. package/dist/server-postgresql/src/services/RelationService.d.ts +98 -0
  54. package/dist/server-postgresql/src/services/entity-helpers.d.ts +38 -0
  55. package/dist/server-postgresql/src/services/entityService.d.ts +104 -0
  56. package/dist/server-postgresql/src/services/index.d.ts +4 -0
  57. package/dist/server-postgresql/src/services/realtimeService.d.ts +188 -0
  58. package/dist/server-postgresql/src/utils/drizzle-conditions.d.ts +116 -0
  59. package/dist/server-postgresql/src/websocket.d.ts +5 -0
  60. package/dist/types/src/controllers/analytics_controller.d.ts +7 -0
  61. package/dist/types/src/controllers/auth.d.ts +119 -0
  62. package/dist/types/src/controllers/client.d.ts +170 -0
  63. package/dist/types/src/controllers/collection_registry.d.ts +45 -0
  64. package/dist/types/src/controllers/customization_controller.d.ts +60 -0
  65. package/dist/types/src/controllers/data.d.ts +168 -0
  66. package/dist/types/src/controllers/data_driver.d.ts +160 -0
  67. package/dist/types/src/controllers/database_admin.d.ts +11 -0
  68. package/dist/types/src/controllers/dialogs_controller.d.ts +36 -0
  69. package/dist/types/src/controllers/effective_role.d.ts +4 -0
  70. package/dist/types/src/controllers/email.d.ts +34 -0
  71. package/dist/types/src/controllers/index.d.ts +18 -0
  72. package/dist/types/src/controllers/local_config_persistence.d.ts +20 -0
  73. package/dist/types/src/controllers/navigation.d.ts +213 -0
  74. package/dist/types/src/controllers/registry.d.ts +54 -0
  75. package/dist/types/src/controllers/side_dialogs_controller.d.ts +67 -0
  76. package/dist/types/src/controllers/side_entity_controller.d.ts +90 -0
  77. package/dist/types/src/controllers/snackbar.d.ts +24 -0
  78. package/dist/types/src/controllers/storage.d.ts +171 -0
  79. package/dist/types/src/index.d.ts +4 -0
  80. package/dist/types/src/rebase_context.d.ts +105 -0
  81. package/dist/types/src/types/backend.d.ts +536 -0
  82. package/dist/types/src/types/builders.d.ts +15 -0
  83. package/dist/types/src/types/chips.d.ts +5 -0
  84. package/dist/types/src/types/collections.d.ts +856 -0
  85. package/dist/types/src/types/cron.d.ts +102 -0
  86. package/dist/types/src/types/data_source.d.ts +64 -0
  87. package/dist/types/src/types/entities.d.ts +145 -0
  88. package/dist/types/src/types/entity_actions.d.ts +98 -0
  89. package/dist/types/src/types/entity_callbacks.d.ts +173 -0
  90. package/dist/types/src/types/entity_link_builder.d.ts +7 -0
  91. package/dist/types/src/types/entity_overrides.d.ts +10 -0
  92. package/dist/types/src/types/entity_views.d.ts +61 -0
  93. package/dist/types/src/types/export_import.d.ts +21 -0
  94. package/dist/types/src/types/index.d.ts +23 -0
  95. package/dist/types/src/types/locales.d.ts +4 -0
  96. package/dist/types/src/types/modify_collections.d.ts +5 -0
  97. package/dist/types/src/types/plugins.d.ts +279 -0
  98. package/dist/types/src/types/properties.d.ts +1176 -0
  99. package/dist/types/src/types/property_config.d.ts +70 -0
  100. package/dist/types/src/types/relations.d.ts +336 -0
  101. package/dist/types/src/types/slots.d.ts +252 -0
  102. package/dist/types/src/types/translations.d.ts +870 -0
  103. package/dist/types/src/types/user_management_delegate.d.ts +121 -0
  104. package/dist/types/src/types/websockets.d.ts +78 -0
  105. package/dist/types/src/users/index.d.ts +2 -0
  106. package/dist/types/src/users/roles.d.ts +22 -0
  107. package/dist/types/src/users/user.d.ts +46 -0
  108. package/drizzle-test/0000_woozy_junta.sql +6 -0
  109. package/drizzle-test/0001_youthful_arachne.sql +1 -0
  110. package/drizzle-test/0002_lively_dragon_lord.sql +2 -0
  111. package/drizzle-test/0003_mean_king_cobra.sql +2 -0
  112. package/drizzle-test/meta/0000_snapshot.json +47 -0
  113. package/drizzle-test/meta/0001_snapshot.json +48 -0
  114. package/drizzle-test/meta/0002_snapshot.json +38 -0
  115. package/drizzle-test/meta/0003_snapshot.json +48 -0
  116. package/drizzle-test/meta/_journal.json +34 -0
  117. package/drizzle-test-out/0000_tan_trauma.sql +6 -0
  118. package/drizzle-test-out/0001_rapid_drax.sql +1 -0
  119. package/drizzle-test-out/meta/0000_snapshot.json +44 -0
  120. package/drizzle-test-out/meta/0001_snapshot.json +54 -0
  121. package/drizzle-test-out/meta/_journal.json +20 -0
  122. package/drizzle.test.config.ts +10 -0
  123. package/jest-all.log +3128 -0
  124. package/jest.log +49 -0
  125. package/package.json +92 -0
  126. package/scratch.ts +41 -0
  127. package/src/PostgresBackendDriver.ts +1008 -0
  128. package/src/PostgresBootstrapper.ts +231 -0
  129. package/src/auth/ensure-tables.ts +381 -0
  130. package/src/auth/services.ts +799 -0
  131. package/src/cli.ts +648 -0
  132. package/src/collections/PostgresCollectionRegistry.ts +96 -0
  133. package/src/connection.ts +84 -0
  134. package/src/data-transformer.ts +608 -0
  135. package/src/databasePoolManager.ts +85 -0
  136. package/src/history/HistoryService.ts +248 -0
  137. package/src/history/ensure-history-table.ts +45 -0
  138. package/src/index.ts +13 -0
  139. package/src/interfaces.ts +60 -0
  140. package/src/schema/auth-schema.ts +169 -0
  141. package/src/schema/doctor-cli.ts +47 -0
  142. package/src/schema/doctor.ts +595 -0
  143. package/src/schema/generate-drizzle-schema-logic.ts +765 -0
  144. package/src/schema/generate-drizzle-schema.ts +151 -0
  145. package/src/schema/introspect-db-logic.ts +542 -0
  146. package/src/schema/introspect-db.ts +211 -0
  147. package/src/schema/test-schema.ts +11 -0
  148. package/src/services/BranchService.ts +237 -0
  149. package/src/services/EntityFetchService.ts +1576 -0
  150. package/src/services/EntityPersistService.ts +349 -0
  151. package/src/services/RelationService.ts +1274 -0
  152. package/src/services/entity-helpers.ts +147 -0
  153. package/src/services/entityService.ts +211 -0
  154. package/src/services/index.ts +13 -0
  155. package/src/services/realtimeService.ts +1034 -0
  156. package/src/utils/drizzle-conditions.ts +1000 -0
  157. package/src/websocket.ts +518 -0
  158. package/test/auth-services.test.ts +661 -0
  159. package/test/batch-many-to-many-regression.test.ts +573 -0
  160. package/test/branchService.test.ts +367 -0
  161. package/test/data-transformer-hardening.test.ts +417 -0
  162. package/test/data-transformer.test.ts +175 -0
  163. package/test/doctor.test.ts +182 -0
  164. package/test/drizzle-conditions.test.ts +895 -0
  165. package/test/entityService.errors.test.ts +367 -0
  166. package/test/entityService.relations.test.ts +1008 -0
  167. package/test/entityService.subcollection-search.test.ts +566 -0
  168. package/test/entityService.test.ts +1035 -0
  169. package/test/generate-drizzle-schema.test.ts +988 -0
  170. package/test/historyService.test.ts +141 -0
  171. package/test/introspect-db-generation.test.ts +436 -0
  172. package/test/introspect-db-utils.test.ts +389 -0
  173. package/test/n-plus-one-regression.test.ts +314 -0
  174. package/test/postgresDataDriver.test.ts +648 -0
  175. package/test/realtimeService.test.ts +307 -0
  176. package/test/relation-pipeline-gaps.test.ts +637 -0
  177. package/test/relations.test.ts +1115 -0
  178. package/test/unmapped-tables-safety.test.ts +345 -0
  179. package/test-drizzle-bug.ts +18 -0
  180. package/test-drizzle-out/0000_cultured_freak.sql +7 -0
  181. package/test-drizzle-out/0001_tiresome_professor_monster.sql +1 -0
  182. package/test-drizzle-out/meta/0000_snapshot.json +55 -0
  183. package/test-drizzle-out/meta/0001_snapshot.json +63 -0
  184. package/test-drizzle-out/meta/_journal.json +20 -0
  185. package/test-drizzle-prompt.sh +2 -0
  186. package/test-policy-prompt.sh +3 -0
  187. package/test-programmatic.ts +30 -0
  188. package/test-programmatic2.ts +59 -0
  189. package/test-schema-no-policies.ts +12 -0
  190. package/test_drizzle_mock.js +3 -0
  191. package/test_find_changed.mjs +32 -0
  192. package/test_hash.js +14 -0
  193. package/test_output.txt +3145 -0
  194. package/tsconfig.json +49 -0
  195. package/tsconfig.prod.json +20 -0
  196. package/vite.config.ts +82 -0
@@ -0,0 +1,121 @@
1
+ import { Role, User } from "../users";
2
+ /**
3
+ * Result of creating a new user via admin flow.
4
+ * Contains the created user plus information about how credentials were delivered.
5
+ */
6
+ export interface UserCreationResult<USER extends User = User> {
7
+ /** The created user */
8
+ user: USER;
9
+ /** Whether an invitation email was sent to the user */
10
+ invitationSent: boolean;
11
+ /**
12
+ * Temporary password (only present when email service is not configured).
13
+ * This is returned one-time and should be shown to the admin to share manually.
14
+ */
15
+ temporaryPassword?: string;
16
+ }
17
+ /**
18
+ * Delegate to manage users, roles, and their permissions.
19
+ * This interface allows the CMS to be completely agnostic of the underlying
20
+ * authentication provider or backend.
21
+ *
22
+ * @group Models
23
+ */
24
+ export interface UserManagementDelegate<USER extends User = User> {
25
+ /**
26
+ * Are the users and roles currently being fetched?
27
+ */
28
+ loading: boolean;
29
+ /**
30
+ * List of users managed by the CMS.
31
+ */
32
+ users: USER[];
33
+ /**
34
+ * Optional error if users failed to load.
35
+ */
36
+ usersError?: Error;
37
+ /**
38
+ * Function to get a user by its uid. This is used to show
39
+ * user information when assigning ownership of an entity.
40
+ * @param uid
41
+ */
42
+ getUser: (uid: string) => USER | null;
43
+ /**
44
+ * Search users with server-side pagination.
45
+ * When provided, the CMS will use this for the users table
46
+ * instead of loading all users into memory.
47
+ */
48
+ searchUsers?: (options: {
49
+ search?: string;
50
+ limit?: number;
51
+ offset?: number;
52
+ orderBy?: string;
53
+ orderDir?: "asc" | "desc";
54
+ roleId?: string;
55
+ }) => Promise<{
56
+ users: USER[];
57
+ total: number;
58
+ }>;
59
+ /**
60
+ * Save a user (create or update)
61
+ * @param user
62
+ */
63
+ saveUser?: (user: USER) => Promise<USER>;
64
+ /**
65
+ * Create a new user with invitation/password generation support.
66
+ * Returns additional info about how the credentials were delivered.
67
+ * Falls back to saveUser if not provided.
68
+ */
69
+ createUser?: (user: USER) => Promise<UserCreationResult<USER>>;
70
+ /**
71
+ * Reset the password for an existing user.
72
+ * Returns a temporary password if no email service is configured,
73
+ * or a flag indicating an email invitation was sent.
74
+ */
75
+ resetPassword?: (user: USER) => Promise<UserCreationResult<USER>>;
76
+ /**
77
+ * Delete a user
78
+ * @param user
79
+ */
80
+ deleteUser?: (user: USER) => Promise<void>;
81
+ /**
82
+ * List of roles defined in the CMS.
83
+ */
84
+ roles?: Role[];
85
+ /**
86
+ * Optional error if roles failed to load.
87
+ */
88
+ rolesError?: Error;
89
+ /**
90
+ * Save a role (create or update)
91
+ * @param role
92
+ */
93
+ saveRole?: (role: Role) => Promise<void>;
94
+ /**
95
+ * Delete a role
96
+ * @param role
97
+ */
98
+ deleteRole?: (role: Role) => Promise<void>;
99
+ /**
100
+ * Is the currently logged in user an admin?
101
+ */
102
+ isAdmin?: boolean;
103
+ /**
104
+ * If true, the UI will allow the user to create the default roles (admin, editor, viewer).
105
+ */
106
+ allowDefaultRolesCreation?: boolean;
107
+ /**
108
+ * Should collection config permissions be included?
109
+ */
110
+ includeCollectionConfigPermissions?: boolean;
111
+ /**
112
+ * Optionally define roles for a given user. This is useful when the roles
113
+ * are coming from a separate provider than the one issuing the tokens.
114
+ */
115
+ defineRolesFor?: (user: USER) => Promise<Role[] | undefined> | Role[] | undefined;
116
+ /**
117
+ * Optional function to bootstrap an admin user.
118
+ * Often used when the database is empty.
119
+ */
120
+ bootstrapAdmin?: () => Promise<void>;
121
+ }
@@ -0,0 +1,78 @@
1
+ import { Entity } from "./entities";
2
+ export interface WebSocketErrorPayload {
3
+ error?: string | {
4
+ message: string;
5
+ code?: string;
6
+ };
7
+ message?: string;
8
+ code?: string;
9
+ }
10
+ export interface WebSocketMessage {
11
+ type: string;
12
+ payload?: unknown;
13
+ subscriptionId?: string;
14
+ requestId?: string;
15
+ entities?: Entity<Record<string, unknown>>[];
16
+ entity?: Entity<Record<string, unknown>> | null;
17
+ error?: string;
18
+ }
19
+ export interface CollectionUpdateMessage extends WebSocketMessage {
20
+ type: "collection_update";
21
+ subscriptionId: string;
22
+ entities: Entity<Record<string, unknown>>[];
23
+ }
24
+ export interface EntityUpdateMessage extends WebSocketMessage {
25
+ type: "entity_update";
26
+ subscriptionId: string;
27
+ entity: Entity<Record<string, unknown>> | null;
28
+ }
29
+ /**
30
+ * Lightweight patch message sent to collection subscribers when a single
31
+ * entity is created, updated, or deleted. The client can merge this into
32
+ * its cached collection data for near-instant cross-tab updates without
33
+ * waiting for a full collection refetch.
34
+ */
35
+ export interface CollectionEntityPatchMessage extends WebSocketMessage {
36
+ type: "collection_entity_patch";
37
+ subscriptionId: string;
38
+ entityId: string;
39
+ /** The updated entity, or null if deleted */
40
+ entity: Entity<Record<string, unknown>> | null;
41
+ }
42
+ /**
43
+ * Column metadata returned by table introspection.
44
+ */
45
+ export interface TableColumnInfo {
46
+ column_name: string;
47
+ data_type: string;
48
+ udt_name: string;
49
+ is_nullable: string;
50
+ column_default: string | null;
51
+ character_maximum_length: number | null;
52
+ /** Enum values, populated for USER-DEFINED (enum) columns */
53
+ enum_values?: string[];
54
+ }
55
+ export interface TableForeignKeyInfo {
56
+ column_name: string;
57
+ foreign_table_name: string;
58
+ foreign_column_name: string;
59
+ }
60
+ export interface TableJunctionInfo {
61
+ junction_table_name: string;
62
+ source_column_name: string;
63
+ target_table_name: string;
64
+ target_column_name: string;
65
+ }
66
+ export interface TablePolicyInfo {
67
+ policy_name: string;
68
+ roles: string[];
69
+ cmd: string;
70
+ qual?: string;
71
+ with_check?: string;
72
+ }
73
+ export interface TableMetadata {
74
+ columns: TableColumnInfo[];
75
+ foreignKeys: TableForeignKeyInfo[];
76
+ junctions: TableJunctionInfo[];
77
+ policies: TablePolicyInfo[];
78
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./user";
2
+ export * from "./roles";
@@ -0,0 +1,22 @@
1
+ export type Role = {
2
+ /**
3
+ * ID of the role
4
+ */
5
+ id: string;
6
+ /**
7
+ * Name of the role
8
+ */
9
+ name: string;
10
+ /**
11
+ * If this flag is true, the user can perform any action
12
+ */
13
+ isAdmin?: boolean;
14
+ /**
15
+ * Permissions related to editing the collections
16
+ */
17
+ config?: {
18
+ createCollections?: boolean;
19
+ editCollections?: boolean | "own";
20
+ deleteCollections?: boolean | "own";
21
+ };
22
+ };
@@ -0,0 +1,46 @@
1
+ /**
2
+ * This interface represents a user.
3
+ * It has some of the same fields as a Firebase User.
4
+ * Note that in the default implementation, we simply take the Firebase user
5
+ * and use it as a Rebase user, so that means that even if they are not mapped
6
+ * in this interface, it contains all the methods of the former, such as `delete`,
7
+ * `getIdToken`, etc.
8
+ *
9
+ * @group Models
10
+ */
11
+ export type User = {
12
+ /**
13
+ * The user's unique ID, scoped to the project.
14
+ */
15
+ readonly uid: string;
16
+ /**
17
+ * The display name of the user.
18
+ */
19
+ readonly displayName: string | null;
20
+ /**
21
+ * The email of the user.
22
+ */
23
+ readonly email: string | null;
24
+ /**
25
+ * The profile photo URL of the user.
26
+ */
27
+ readonly photoURL: string | null;
28
+ /**
29
+ * The provider used to authenticate the user.
30
+ */
31
+ readonly providerId: string;
32
+ /**
33
+ *
34
+ */
35
+ readonly isAnonymous: boolean;
36
+ /**
37
+ * Role IDs assigned to this user (e.g. ["admin", "editor"]).
38
+ * These are plain string IDs — use the UserManagementDelegate to look up full Role objects.
39
+ */
40
+ roles?: string[];
41
+ /**
42
+ * The date and time when the user was created.
43
+ */
44
+ createdAt?: Date | string | null;
45
+ getIdToken?: (forceRefresh?: boolean) => Promise<string>;
46
+ };
@@ -0,0 +1,6 @@
1
+ CREATE TABLE "test" (
2
+ "id" text PRIMARY KEY NOT NULL
3
+ );
4
+ --> statement-breakpoint
5
+ ALTER TABLE "test" ENABLE ROW LEVEL SECURITY;--> statement-breakpoint
6
+ CREATE POLICY "old_policy" ON "test" AS PERMISSIVE FOR SELECT TO public;
@@ -0,0 +1 @@
1
+ ALTER POLICY "old_policy" ON "test" TO public USING (true);
@@ -0,0 +1,2 @@
1
+ ALTER TABLE "test" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint
2
+ DROP POLICY "old_policy" ON "test" CASCADE;
@@ -0,0 +1,2 @@
1
+ ALTER TABLE "test" ENABLE ROW LEVEL SECURITY;--> statement-breakpoint
2
+ CREATE POLICY "new_policy" ON "test" AS PERMISSIVE FOR SELECT TO public USING (true);
@@ -0,0 +1,47 @@
1
+ {
2
+ "id": "929ed59c-6874-4679-8649-8d3f7dd62890",
3
+ "prevId": "00000000-0000-0000-0000-000000000000",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "public.test": {
8
+ "name": "test",
9
+ "schema": "",
10
+ "columns": {
11
+ "id": {
12
+ "name": "id",
13
+ "type": "text",
14
+ "primaryKey": true,
15
+ "notNull": true
16
+ }
17
+ },
18
+ "indexes": {},
19
+ "foreignKeys": {},
20
+ "compositePrimaryKeys": {},
21
+ "uniqueConstraints": {},
22
+ "policies": {
23
+ "old_policy": {
24
+ "name": "old_policy",
25
+ "as": "PERMISSIVE",
26
+ "for": "SELECT",
27
+ "to": [
28
+ "public"
29
+ ]
30
+ }
31
+ },
32
+ "checkConstraints": {},
33
+ "isRLSEnabled": false
34
+ }
35
+ },
36
+ "enums": {},
37
+ "schemas": {},
38
+ "sequences": {},
39
+ "roles": {},
40
+ "policies": {},
41
+ "views": {},
42
+ "_meta": {
43
+ "columns": {},
44
+ "schemas": {},
45
+ "tables": {}
46
+ }
47
+ }
@@ -0,0 +1,48 @@
1
+ {
2
+ "id": "8c2b226d-6aa5-4c33-b94b-7ba184d457ba",
3
+ "prevId": "929ed59c-6874-4679-8649-8d3f7dd62890",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "public.test": {
8
+ "name": "test",
9
+ "schema": "",
10
+ "columns": {
11
+ "id": {
12
+ "name": "id",
13
+ "type": "text",
14
+ "primaryKey": true,
15
+ "notNull": true
16
+ }
17
+ },
18
+ "indexes": {},
19
+ "foreignKeys": {},
20
+ "compositePrimaryKeys": {},
21
+ "uniqueConstraints": {},
22
+ "policies": {
23
+ "old_policy": {
24
+ "name": "old_policy",
25
+ "as": "PERMISSIVE",
26
+ "for": "SELECT",
27
+ "to": [
28
+ "public"
29
+ ],
30
+ "using": "true"
31
+ }
32
+ },
33
+ "checkConstraints": {},
34
+ "isRLSEnabled": false
35
+ }
36
+ },
37
+ "enums": {},
38
+ "schemas": {},
39
+ "sequences": {},
40
+ "roles": {},
41
+ "policies": {},
42
+ "views": {},
43
+ "_meta": {
44
+ "columns": {},
45
+ "schemas": {},
46
+ "tables": {}
47
+ }
48
+ }
@@ -0,0 +1,38 @@
1
+ {
2
+ "id": "d30b4ec3-fde2-43ff-ad78-48fa68b0574a",
3
+ "prevId": "8c2b226d-6aa5-4c33-b94b-7ba184d457ba",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "public.test": {
8
+ "name": "test",
9
+ "schema": "",
10
+ "columns": {
11
+ "id": {
12
+ "name": "id",
13
+ "type": "text",
14
+ "primaryKey": true,
15
+ "notNull": true
16
+ }
17
+ },
18
+ "indexes": {},
19
+ "foreignKeys": {},
20
+ "compositePrimaryKeys": {},
21
+ "uniqueConstraints": {},
22
+ "policies": {},
23
+ "checkConstraints": {},
24
+ "isRLSEnabled": false
25
+ }
26
+ },
27
+ "enums": {},
28
+ "schemas": {},
29
+ "sequences": {},
30
+ "roles": {},
31
+ "policies": {},
32
+ "views": {},
33
+ "_meta": {
34
+ "columns": {},
35
+ "schemas": {},
36
+ "tables": {}
37
+ }
38
+ }
@@ -0,0 +1,48 @@
1
+ {
2
+ "id": "ed312842-4f9b-48a9-af26-036c1f5d7eee",
3
+ "prevId": "d30b4ec3-fde2-43ff-ad78-48fa68b0574a",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "public.test": {
8
+ "name": "test",
9
+ "schema": "",
10
+ "columns": {
11
+ "id": {
12
+ "name": "id",
13
+ "type": "text",
14
+ "primaryKey": true,
15
+ "notNull": true
16
+ }
17
+ },
18
+ "indexes": {},
19
+ "foreignKeys": {},
20
+ "compositePrimaryKeys": {},
21
+ "uniqueConstraints": {},
22
+ "policies": {
23
+ "new_policy": {
24
+ "name": "new_policy",
25
+ "as": "PERMISSIVE",
26
+ "for": "SELECT",
27
+ "to": [
28
+ "public"
29
+ ],
30
+ "using": "true"
31
+ }
32
+ },
33
+ "checkConstraints": {},
34
+ "isRLSEnabled": false
35
+ }
36
+ },
37
+ "enums": {},
38
+ "schemas": {},
39
+ "sequences": {},
40
+ "roles": {},
41
+ "policies": {},
42
+ "views": {},
43
+ "_meta": {
44
+ "columns": {},
45
+ "schemas": {},
46
+ "tables": {}
47
+ }
48
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "version": "7",
3
+ "dialect": "postgresql",
4
+ "entries": [
5
+ {
6
+ "idx": 0,
7
+ "version": "7",
8
+ "when": 1777412472270,
9
+ "tag": "0000_woozy_junta",
10
+ "breakpoints": true
11
+ },
12
+ {
13
+ "idx": 1,
14
+ "version": "7",
15
+ "when": 1777412577921,
16
+ "tag": "0001_youthful_arachne",
17
+ "breakpoints": true
18
+ },
19
+ {
20
+ "idx": 2,
21
+ "version": "7",
22
+ "when": 1777412591133,
23
+ "tag": "0002_lively_dragon_lord",
24
+ "breakpoints": true
25
+ },
26
+ {
27
+ "idx": 3,
28
+ "version": "7",
29
+ "when": 1777412614502,
30
+ "tag": "0003_mean_king_cobra",
31
+ "breakpoints": true
32
+ }
33
+ ]
34
+ }
@@ -0,0 +1,6 @@
1
+ CREATE TABLE "users" (
2
+ "id" integer PRIMARY KEY NOT NULL,
3
+ "name" varchar
4
+ );
5
+ --> statement-breakpoint
6
+ ALTER TABLE "users" ENABLE ROW LEVEL SECURITY;
@@ -0,0 +1 @@
1
+ CREATE POLICY "test_policy" ON "users" AS PERMISSIVE FOR ALL TO public USING (true);
@@ -0,0 +1,44 @@
1
+ {
2
+ "id": "ef1380c9-de61-4080-98b0-f790a94d4384",
3
+ "prevId": "00000000-0000-0000-0000-000000000000",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "public.users": {
8
+ "name": "users",
9
+ "schema": "",
10
+ "columns": {
11
+ "id": {
12
+ "name": "id",
13
+ "type": "integer",
14
+ "primaryKey": true,
15
+ "notNull": true
16
+ },
17
+ "name": {
18
+ "name": "name",
19
+ "type": "varchar",
20
+ "primaryKey": false,
21
+ "notNull": false
22
+ }
23
+ },
24
+ "indexes": {},
25
+ "foreignKeys": {},
26
+ "compositePrimaryKeys": {},
27
+ "uniqueConstraints": {},
28
+ "policies": {},
29
+ "checkConstraints": {},
30
+ "isRLSEnabled": true
31
+ }
32
+ },
33
+ "enums": {},
34
+ "schemas": {},
35
+ "sequences": {},
36
+ "roles": {},
37
+ "policies": {},
38
+ "views": {},
39
+ "_meta": {
40
+ "columns": {},
41
+ "schemas": {},
42
+ "tables": {}
43
+ }
44
+ }
@@ -0,0 +1,54 @@
1
+ {
2
+ "id": "d98375cd-115c-4ec6-ae56-cbcc39ea8b13",
3
+ "prevId": "ef1380c9-de61-4080-98b0-f790a94d4384",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "public.users": {
8
+ "name": "users",
9
+ "schema": "",
10
+ "columns": {
11
+ "id": {
12
+ "name": "id",
13
+ "type": "integer",
14
+ "primaryKey": true,
15
+ "notNull": true
16
+ },
17
+ "name": {
18
+ "name": "name",
19
+ "type": "varchar",
20
+ "primaryKey": false,
21
+ "notNull": false
22
+ }
23
+ },
24
+ "indexes": {},
25
+ "foreignKeys": {},
26
+ "compositePrimaryKeys": {},
27
+ "uniqueConstraints": {},
28
+ "policies": {
29
+ "test_policy": {
30
+ "name": "test_policy",
31
+ "as": "PERMISSIVE",
32
+ "for": "ALL",
33
+ "to": [
34
+ "public"
35
+ ],
36
+ "using": "true"
37
+ }
38
+ },
39
+ "checkConstraints": {},
40
+ "isRLSEnabled": true
41
+ }
42
+ },
43
+ "enums": {},
44
+ "schemas": {},
45
+ "sequences": {},
46
+ "roles": {},
47
+ "policies": {},
48
+ "views": {},
49
+ "_meta": {
50
+ "columns": {},
51
+ "schemas": {},
52
+ "tables": {}
53
+ }
54
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "version": "7",
3
+ "dialect": "postgresql",
4
+ "entries": [
5
+ {
6
+ "idx": 0,
7
+ "version": "7",
8
+ "when": 1777413439093,
9
+ "tag": "0000_tan_trauma",
10
+ "breakpoints": true
11
+ },
12
+ {
13
+ "idx": 1,
14
+ "version": "7",
15
+ "when": 1777413457223,
16
+ "tag": "0001_rapid_drax",
17
+ "breakpoints": true
18
+ }
19
+ ]
20
+ }
@@ -0,0 +1,10 @@
1
+ import { defineConfig } from "drizzle-kit";
2
+
3
+ export default defineConfig({
4
+ schema: "./test-schema-no-policies.ts",
5
+ out: "./drizzle-test-out",
6
+ dialect: "postgresql",
7
+ dbCredentials: {
8
+ url: process.env.DATABASE_URL || "postgres://postgres:postgres@localhost:5432/postgres"
9
+ }
10
+ });