index.d.ts 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. import { ConnectionOptions } from 'tls';
  2. declare const prefixes: readonly ["index", "timestamp", "supabase", "unix", "none"];
  3. type Prefix = (typeof prefixes)[number];
  4. declare const drivers: readonly ["d1-http", "expo", "aws-data-api", "pglite", "durable-sqlite"];
  5. type Driver = (typeof drivers)[number];
  6. declare const dialects: readonly ["postgresql", "mysql", "sqlite", "turso", "singlestore", "gel"];
  7. type Dialect = (typeof dialects)[number];
  8. type SslOptions = {
  9. pfx?: string;
  10. key?: string;
  11. passphrase?: string;
  12. cert?: string;
  13. ca?: string | string[];
  14. crl?: string | string[];
  15. ciphers?: string;
  16. rejectUnauthorized?: boolean;
  17. };
  18. type Verify<T, U extends T> = U;
  19. /**
  20. * **You are currently using version 0.21.0+ of drizzle-kit. If you have just upgraded to this version, please make sure to read the changelog to understand what changes have been made and what
  21. * adjustments may be necessary for you. See https://orm.drizzle.team/kit-docs/upgrade-21#how-to-migrate-to-0210**
  22. *
  23. * **Config** usage:
  24. *
  25. * `dialect` - mandatory and is responsible for explicitly providing a databse dialect you are using for all the commands
  26. * *Possible values*: `postgresql`, `mysql`, `sqlite`, `singlestore
  27. *
  28. * See https://orm.drizzle.team/kit-docs/config-reference#dialect
  29. *
  30. * ---
  31. * `schema` - param lets you define where your schema file/files live.
  32. * You can have as many separate schema files as you want and define paths to them using glob or array of globs syntax.
  33. *
  34. * See https://orm.drizzle.team/kit-docs/config-reference#schema
  35. *
  36. * ---
  37. * `out` - allows you to define the folder for your migrations and a folder, where drizzle will introspect the schema and relations
  38. *
  39. * See https://orm.drizzle.team/kit-docs/config-reference#out
  40. *
  41. * ---
  42. * `driver` - optional param that is responsible for explicitly providing a driver to use when accessing a database
  43. * *Possible values*: `aws-data-api`, `d1-http`, `expo`, `turso`, `pglite`
  44. * If you don't use AWS Data API, D1, Turso or Expo - ypu don't need this driver. You can check a driver strategy choice here: https://orm.drizzle.team/kit-docs/upgrade-21
  45. *
  46. * See https://orm.drizzle.team/kit-docs/config-reference#driver
  47. *
  48. * ---
  49. *
  50. * `dbCredentials` - an object to define your connection to the database. For more info please check the docs
  51. *
  52. * See https://orm.drizzle.team/kit-docs/config-reference#dbcredentials
  53. *
  54. * ---
  55. *
  56. * `migrations` - param let’s use specify custom table and schema(PostgreSQL only) for migrations.
  57. * By default, all information about executed migrations will be stored in the database inside
  58. * the `__drizzle_migrations` table, and for PostgreSQL, inside the drizzle schema.
  59. * However, you can configure where to store those records.
  60. *
  61. * See https://orm.drizzle.team/kit-docs/config-reference#migrations
  62. *
  63. * ---
  64. *
  65. * `breakpoints` - param lets you enable/disable SQL statement breakpoints in generated migrations.
  66. * It’s optional and true by default, it’s necessary to properly apply migrations on databases,
  67. * that do not support multiple DDL alternation statements in one transaction(MySQL, SQLite, SingleStore) and
  68. * Drizzle ORM has to apply them sequentially one by one.
  69. *
  70. * See https://orm.drizzle.team/kit-docs/config-reference#breakpoints
  71. *
  72. * ---
  73. *
  74. * `tablesFilters` - param lets you filter tables with glob syntax for db push command.
  75. * It’s useful when you have only one database avaialable for several separate projects with separate sql schemas.
  76. *
  77. * How to define multi-project tables with Drizzle ORM — see https://orm.drizzle.team/docs/goodies#multi-project-schema
  78. *
  79. * See https://orm.drizzle.team/kit-docs/config-reference#tablesfilters
  80. *
  81. * ---
  82. *
  83. * `schemaFilter` - parameter allows you to define which schema in PostgreSQL should be used for either introspect or push commands.
  84. * This parameter accepts a single schema as a string or an array of schemas as strings.
  85. * No glob pattern is supported here. By default, drizzle will use the public schema for both commands,
  86. * but you can add any schema you need.
  87. *
  88. * For example, having schemaFilter: ["my_schema"] will only look for tables in both the database and
  89. * drizzle schema that are a part of the my_schema schema.
  90. *
  91. * See https://orm.drizzle.team/kit-docs/config-reference#schemafilter
  92. *
  93. * ---
  94. *
  95. * `verbose` - command is used for drizzle-kit push commands and prints all statements that will be executed.
  96. *
  97. * > Note: This command will only print the statements that should be executed.
  98. * To approve them before applying, please refer to the `strict` command.
  99. *
  100. * See https://orm.drizzle.team/kit-docs/config-reference#verbose
  101. *
  102. * ---
  103. *
  104. * `strict` - command is used for drizzle-kit push commands and will always ask for your confirmation,
  105. * either to execute all statements needed to sync your schema with the database or not.
  106. *
  107. * See https://orm.drizzle.team/kit-docs/config-reference#strict
  108. */
  109. type Config = {
  110. dialect: Dialect;
  111. out?: string;
  112. breakpoints?: boolean;
  113. tablesFilter?: string | string[];
  114. extensionsFilters?: 'postgis'[];
  115. schemaFilter?: string | string[];
  116. schema?: string | string[];
  117. verbose?: boolean;
  118. strict?: boolean;
  119. casing?: 'camelCase' | 'snake_case';
  120. migrations?: {
  121. table?: string;
  122. schema?: string;
  123. prefix?: Prefix;
  124. };
  125. introspect?: {
  126. casing: 'camel' | 'preserve';
  127. };
  128. entities?: {
  129. roles?: boolean | {
  130. provider?: 'supabase' | 'neon' | string & {};
  131. exclude?: string[];
  132. include?: string[];
  133. };
  134. };
  135. } & ({
  136. dialect: Verify<Dialect, 'turso'>;
  137. dbCredentials: {
  138. url: string;
  139. authToken?: string;
  140. };
  141. } | {
  142. dialect: Verify<Dialect, 'sqlite'>;
  143. dbCredentials: {
  144. url: string;
  145. };
  146. } | {
  147. dialect: Verify<Dialect, 'postgresql'>;
  148. dbCredentials: ({
  149. host: string;
  150. port?: number;
  151. user?: string;
  152. password?: string;
  153. database: string;
  154. ssl?: boolean | 'require' | 'allow' | 'prefer' | 'verify-full' | ConnectionOptions;
  155. } & {}) | {
  156. url: string;
  157. };
  158. } | {
  159. dialect: Verify<Dialect, 'postgresql'>;
  160. driver: Verify<Driver, 'aws-data-api'>;
  161. dbCredentials: {
  162. database: string;
  163. secretArn: string;
  164. resourceArn: string;
  165. };
  166. } | {
  167. dialect: Verify<Dialect, 'postgresql'>;
  168. driver: Verify<Driver, 'pglite'>;
  169. dbCredentials: {
  170. url: string;
  171. };
  172. } | {
  173. dialect: Verify<Dialect, 'mysql'>;
  174. dbCredentials: {
  175. host: string;
  176. port?: number;
  177. user?: string;
  178. password?: string;
  179. database: string;
  180. ssl?: string | SslOptions;
  181. } | {
  182. url: string;
  183. };
  184. } | {
  185. dialect: Verify<Dialect, 'sqlite'>;
  186. driver: Verify<Driver, 'd1-http'>;
  187. dbCredentials: {
  188. accountId: string;
  189. databaseId: string;
  190. token: string;
  191. };
  192. } | {
  193. dialect: Verify<Dialect, 'sqlite'>;
  194. driver: Verify<Driver, 'expo'>;
  195. } | {
  196. dialect: Verify<Dialect, 'sqlite'>;
  197. driver: Verify<Driver, 'durable-sqlite'>;
  198. } | {} | {
  199. dialect: Verify<Dialect, 'singlestore'>;
  200. dbCredentials: {
  201. host: string;
  202. port?: number;
  203. user?: string;
  204. password?: string;
  205. database: string;
  206. ssl?: string | SslOptions;
  207. } | {
  208. url: string;
  209. };
  210. } | {
  211. dialect: Verify<Dialect, 'gel'>;
  212. dbCredentials?: {
  213. tlsSecurity?: 'insecure' | 'no_host_verification' | 'strict' | 'default';
  214. } & ({
  215. url: string;
  216. } | ({
  217. host: string;
  218. port?: number;
  219. user?: string;
  220. password?: string;
  221. database: string;
  222. }));
  223. });
  224. /**
  225. * **You are currently using version 0.21.0+ of drizzle-kit. If you have just upgraded to this version, please make sure to read the changelog to understand what changes have been made and what
  226. * adjustments may be necessary for you. See https://orm.drizzle.team/kit-docs/upgrade-21#how-to-migrate-to-0210**
  227. *
  228. * **Config** usage:
  229. *
  230. * `dialect` - mandatory and is responsible for explicitly providing a databse dialect you are using for all the commands
  231. * *Possible values*: `postgresql`, `mysql`, `sqlite`, `singlestore`, `gel`
  232. *
  233. * See https://orm.drizzle.team/kit-docs/config-reference#dialect
  234. *
  235. * ---
  236. * `schema` - param lets you define where your schema file/files live.
  237. * You can have as many separate schema files as you want and define paths to them using glob or array of globs syntax.
  238. *
  239. * See https://orm.drizzle.team/kit-docs/config-reference#schema
  240. *
  241. * ---
  242. * `out` - allows you to define the folder for your migrations and a folder, where drizzle will introspect the schema and relations
  243. *
  244. * See https://orm.drizzle.team/kit-docs/config-reference#out
  245. *
  246. * ---
  247. * `driver` - optional param that is responsible for explicitly providing a driver to use when accessing a database
  248. * *Possible values*: `aws-data-api`, `d1-http`, `expo`, `turso`, `pglite`
  249. * If you don't use AWS Data API, D1, Turso or Expo - ypu don't need this driver. You can check a driver strategy choice here: https://orm.drizzle.team/kit-docs/upgrade-21
  250. *
  251. * See https://orm.drizzle.team/kit-docs/config-reference#driver
  252. *
  253. * ---
  254. *
  255. * `dbCredentials` - an object to define your connection to the database. For more info please check the docs
  256. *
  257. * See https://orm.drizzle.team/kit-docs/config-reference#dbcredentials
  258. *
  259. * ---
  260. *
  261. * `migrations` - param let’s use specify custom table and schema(PostgreSQL only) for migrations.
  262. * By default, all information about executed migrations will be stored in the database inside
  263. * the `__drizzle_migrations` table, and for PostgreSQL, inside the drizzle schema.
  264. * However, you can configure where to store those records.
  265. *
  266. * See https://orm.drizzle.team/kit-docs/config-reference#migrations
  267. *
  268. * ---
  269. *
  270. * `breakpoints` - param lets you enable/disable SQL statement breakpoints in generated migrations.
  271. * It’s optional and true by default, it’s necessary to properly apply migrations on databases,
  272. * that do not support multiple DDL alternation statements in one transaction(MySQL, SQLite, SingleStore) and
  273. * Drizzle ORM has to apply them sequentially one by one.
  274. *
  275. * See https://orm.drizzle.team/kit-docs/config-reference#breakpoints
  276. *
  277. * ---
  278. *
  279. * `tablesFilters` - param lets you filter tables with glob syntax for db push command.
  280. * It’s useful when you have only one database avaialable for several separate projects with separate sql schemas.
  281. *
  282. * How to define multi-project tables with Drizzle ORM — see https://orm.drizzle.team/docs/goodies#multi-project-schema
  283. *
  284. * See https://orm.drizzle.team/kit-docs/config-reference#tablesfilters
  285. *
  286. * ---
  287. *
  288. * `schemaFilter` - parameter allows you to define which schema in PostgreSQL should be used for either introspect or push commands.
  289. * This parameter accepts a single schema as a string or an array of schemas as strings.
  290. * No glob pattern is supported here. By default, drizzle will use the public schema for both commands,
  291. * but you can add any schema you need.
  292. *
  293. * For example, having schemaFilter: ["my_schema"] will only look for tables in both the database and
  294. * drizzle schema that are a part of the my_schema schema.
  295. *
  296. * See https://orm.drizzle.team/kit-docs/config-reference#schemafilter
  297. *
  298. * ---
  299. *
  300. * `verbose` - command is used for drizzle-kit push commands and prints all statements that will be executed.
  301. *
  302. * > Note: This command will only print the statements that should be executed.
  303. * To approve them before applying, please refer to the `strict` command.
  304. *
  305. * See https://orm.drizzle.team/kit-docs/config-reference#verbose
  306. *
  307. * ---
  308. *
  309. * `strict` - command is used for drizzle-kit push commands and will always ask for your confirmation,
  310. * either to execute all statements needed to sync your schema with the database or not.
  311. *
  312. * See https://orm.drizzle.team/kit-docs/config-reference#strict
  313. */
  314. declare function defineConfig(config: Config): Config;
  315. export { type Config, defineConfig };