supabase 0.4.3 → 1.1.6

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2020 Supabase
3
+ Copyright (c) 2021 Bobbie Soedirgo
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,47 +1,128 @@
1
- # Supabase CLI
1
+ # Supabase CLI (v1)
2
+
3
+ [![Coverage Status](https://coveralls.io/repos/github/supabase/cli/badge.svg?branch=main)](https://coveralls.io/github/supabase/cli?branch=main)
2
4
 
3
5
  [Supabase](https://supabase.io) is an open source Firebase alternative. We're building the features of Firebase using enterprise-grade open source tools.
4
6
 
5
- This repository contains all the functionality for our CLI. It is still under heavy development.
7
+ This repository contains all the functionality for our CLI.
6
8
 
7
9
  - [x] Running Supabase locally
8
- - [x] Self-hosting
9
- - [ ] Managing database migrations (in progress)
10
- - [ ] Pushing your local changes to production
10
+ - [x] Managing database migrations
11
+ - [x] Pushing your local changes to production
12
+ - [x] Create and Deploy Supabase Functions
11
13
  - [ ] Manage your Supabase Account
12
- - [ ] Manage your Supabase Projects
13
- - [ ] Generating types directly from your database schema
14
+ - [x] Manage your Supabase Projects
15
+ - [x] Generating types directly from your database schema
14
16
  - [ ] Generating API and validation schemas from your database
15
17
 
16
- ## Documentation
18
+ ## Getting started
17
19
 
18
- For full documentation, visit [supabase.io/docs](https://supabase.io/docs/reference/cli/getting-started)
20
+ ### Install the CLI
19
21
 
20
- ## Community & Support
22
+ #### macOS
21
23
 
22
- - [Community Forum](https://github.com/supabase/supabase/discussions). Best for: help with building, discussion about database best practices.
23
- - [GitHub Issues](https://github.com/supabase/supabase/issues). Best for: bugs and errors you encounter using Supabase.
24
- - [Email Support](https://supabase.io/docs/support#business-support). Best for: problems with your database or infrastructure.
24
+ Available via [Homebrew](https://brew.sh). To install:
25
25
 
26
+ ```sh
27
+ brew install supabase/tap/supabase
28
+ ```
26
29
 
27
- ## Getting started
30
+ To upgrade:
31
+
32
+ ```sh
33
+ brew upgrade supabase
34
+ ```
35
+
36
+ #### Windows
37
+
38
+ Available via [Scoop](https://scoop.sh). To install:
39
+
40
+ ```powershell
41
+ scoop bucket add supabase https://github.com/supabase/scoop-bucket.git
42
+ scoop install supabase
43
+ ```
44
+
45
+ To upgrade:
46
+
47
+ ```powershell
48
+ scoop update supabase
49
+ ```
50
+
51
+ #### Linux
52
+
53
+ Available via [Homebrew](https://brew.sh) and Linux packages.
54
+
55
+ ##### via Homebrew
56
+
57
+ To install:
58
+
59
+ ```sh
60
+ brew install supabase/tap/supabase
61
+ ```
28
62
 
29
- ### Install
63
+ To upgrade:
30
64
 
31
65
  ```sh
32
- npm install supabase -g
66
+ brew upgrade supabase
33
67
  ```
34
68
 
35
- ### Commands:
69
+ ##### via Linux packages
70
+
71
+ Linux packages are provided in [Releases](https://github.com/supabase/cli/releases). To install, download the `.apk`/`.deb`/`.rpm` file depending on your package manager and run the respective commands.
36
72
 
37
- - [`supabase init`](https://supabase.io/docs/reference/cli/supabase-init): Initialize project
38
- - [`supabase start`](https://supabase.io/docs/reference/cli/supabase-start): Start Supabase locally
39
- - [`supabase stop`](https://supabase.io/docs/reference/cli/supabase-stop): Stop Supabase locally
40
- - [`supabase eject`](https://supabase.io/docs/reference/cli/supabase-eject): Create a docker directory with the Docker setup.
73
+ ```sh
74
+ sudo apk add --allow-untrusted <...>.apk
75
+ ```
76
+
77
+ ```sh
78
+ sudo dpkg -i <...>.deb
79
+ ```
80
+
81
+ ```sh
82
+ sudo rpm -i <...>.rpm
83
+ ```
84
+
85
+ #### Other Platforms
86
+
87
+ You can also install the CLI via [go modules](https://go.dev/ref/mod#go-install) without the help of package managers.
88
+
89
+ ```sh
90
+ go install github.com/supabase/cli@latest
91
+ ```
92
+
93
+ Add a symlink to the binary in `$PATH` for easier access:
94
+
95
+ ```sh
96
+ ln -s "$(go env GOPATH)/cli" /usr/bin/supabase
97
+ ```
98
+
99
+ This works on non-standard linux distros, like archlinux.
100
+
101
+ ### Run the CLI
102
+
103
+ ```sh
104
+ supabase help
105
+ ```
106
+
107
+ ## Docs
108
+
109
+ Command & config reference can be found [here](https://supabase.com/docs/reference/cli/about).
110
+
111
+ ## Breaking changes
112
+
113
+ The CLI is a WIP and we're still exploring the design, so expect a lot of breaking changes. We try to document migration steps in [Releases](https://github.com/supabase/cli/releases). Please file an issue if these steps don't work!
114
+
115
+ ## Developing
116
+
117
+ To run from source:
118
+
119
+ ```sh
120
+ # Go >= 1.18
121
+ go run . help
122
+ ```
41
123
 
42
124
  ---
43
125
 
44
126
  ## Sponsors
45
127
 
46
128
  [![New Sponsor](https://user-images.githubusercontent.com/10214025/90518111-e74bbb00-e198-11ea-8f88-c9e3c1aa4b5b.png)](https://github.com/sponsors/supabase)
47
-
package/package.json CHANGED
@@ -1,37 +1,28 @@
1
1
  {
2
2
  "name": "supabase",
3
- "version": "0.4.3",
3
+ "version": "1.1.6",
4
4
  "description": "Supabase CLI",
5
- "homepage": "https://github.com/supabase/cli",
5
+ "repository": "supabase/cli",
6
+ "homepage": "https://supabase.com/docs/reference/cli",
6
7
  "bugs": "https://github.com/supabase/cli/issues",
7
8
  "license": "MIT",
8
9
  "author": "Supabase",
10
+ "type": "module",
9
11
  "files": [
10
- "dist"
12
+ "scripts"
11
13
  ],
12
- "bin": "dist/cli.js",
13
- "repository": "supabase/cli",
14
14
  "scripts": {
15
- "dev": "ts-node src/cli.ts",
16
- "clean": "rimraf dist",
17
- "format": "prettier --write \"{src,test}/**/*.ts\"",
18
- "build": "npm run clean && tsc --project tsconfig.json && cpy --cwd=src --parents templates ../dist/",
19
- "start": "node dist/cli.js",
20
- "test": "jest"
15
+ "preinstall": "node scripts/preinstall.js"
21
16
  },
17
+ "url": "https://github.com/supabase/cli/releases/download/v{{version}}/{{bin_name}}_{{version}}_{{platform}}_{{arch}}.tar.gz",
18
+ "bin": "bin/supabase",
22
19
  "dependencies": {
23
- "gluegun": "^4.6.1",
24
- "ignore": "^5.1.8"
20
+ "node-fetch": "^3.2.10",
21
+ "tar": "6.1.11"
25
22
  },
26
- "devDependencies": {
27
- "@types/jest": "^26.0.22",
28
- "@types/node": "^12.20.7",
29
- "cpy-cli": "^3.1.1",
30
- "husky": "^4.3.8",
31
- "jest": "^26.6.3",
32
- "rimraf": "^3.0.2",
33
- "ts-jest": "^26.5.4",
34
- "ts-node": "^9.1.1",
35
- "typescript": "^4.2.3"
23
+ "release": {
24
+ "branches": [
25
+ "main"
26
+ ]
36
27
  }
37
28
  }
@@ -0,0 +1,113 @@
1
+ #!/usr/bin/env node
2
+
3
+ // Ref 1: https://github.com/sanathkr/go-npm
4
+ // Ref 2: https://blog.xendit.engineer/how-we-repurposed-npm-to-publish-and-distribute-our-go-binaries-for-internal-cli-23981b80911b
5
+ "use strict";
6
+
7
+ import fetch from "node-fetch";
8
+ import path from "path";
9
+ import tar from "tar";
10
+ import zlib from "zlib";
11
+ import fs from "fs";
12
+
13
+ // Mapping from Node's `process.arch` to Golang's `$GOARCH`
14
+ const ARCH_MAPPING = {
15
+ x64: "amd64",
16
+ arm64: "arm64",
17
+ };
18
+
19
+ // Mapping between Node's `process.platform` to Golang's
20
+ const PLATFORM_MAPPING = {
21
+ darwin: "darwin",
22
+ linux: "linux",
23
+ win32: "windows",
24
+ };
25
+
26
+ function validateConfiguration(packageJson) {
27
+ if (!packageJson.version) {
28
+ return "'version' property must be specified";
29
+ }
30
+
31
+ if (!packageJson.bin) {
32
+ return "'bin' property must be specified";
33
+ }
34
+
35
+ if (!packageJson.url) {
36
+ return "'url' property must be specified";
37
+ }
38
+ }
39
+
40
+ async function parsePackageJson() {
41
+ if (!ARCH_MAPPING[process.arch]) {
42
+ throw Error(
43
+ "Installation is not supported for this architecture: " + process.arch
44
+ );
45
+ }
46
+
47
+ if (!PLATFORM_MAPPING[process.platform]) {
48
+ throw Error(
49
+ "Installation is not supported for this platform: " + process.platform
50
+ );
51
+ }
52
+
53
+ const packageJsonPath = path.join(".", "package.json");
54
+ const contents = await fs.promises.readFile(packageJsonPath);
55
+ const packageJson = JSON.parse(contents);
56
+ const error = validateConfiguration(packageJson);
57
+ if (error) {
58
+ throw Error("Invalid package.json: " + error);
59
+ }
60
+
61
+ // We have validated the config. It exists in all its glory
62
+ let binName = path.basename(packageJson.bin);
63
+ const binPath = path.dirname(packageJson.bin);
64
+ let url = packageJson.url;
65
+ let version = packageJson.version;
66
+
67
+ // strip the 'v' if necessary v0.0.1 => 0.0.1
68
+ if (version[0] === "v") version = version.substr(1);
69
+
70
+ // Binary name on Windows has .exe suffix
71
+ if (process.platform === "win32") {
72
+ binName += ".exe";
73
+ }
74
+
75
+ // Interpolate variables in URL, if necessary
76
+ url = url.replace(/{{arch}}/g, ARCH_MAPPING[process.arch]);
77
+ url = url.replace(/{{platform}}/g, PLATFORM_MAPPING[process.platform]);
78
+ url = url.replace(/{{version}}/g, version);
79
+ url = url.replace(/{{bin_name}}/g, binName);
80
+
81
+ return { binName, binPath, url, version };
82
+ }
83
+
84
+ /**
85
+ * Reads the configuration from application's package.json,
86
+ * validates properties, copied the binary from the package and stores at
87
+ * ./bin in the package's root. NPM already has support to install binary files
88
+ * specific locations when invoked with "npm install -g"
89
+ *
90
+ * See: https://docs.npmjs.com/files/package.json#bin
91
+ */
92
+ async function main() {
93
+ const opts = await parsePackageJson();
94
+ await fs.promises.mkdir(opts.binPath, { recursive: true });
95
+
96
+ // First we will Un-GZip, then we will untar. So once untar is completed,
97
+ // binary is downloaded into `downloadPath`. Verify the binary and call it good
98
+ const ungz = zlib.createGunzip();
99
+ const untar = tar.x({ cwd: opts.binPath }, [opts.binName]);
100
+
101
+ console.info("Downloading", opts.url);
102
+ const resp = await fetch(opts.url);
103
+ resp.body.pipe(ungz).pipe(untar);
104
+ await new Promise((resolve, reject) => {
105
+ untar.on("error", reject);
106
+ untar.on("end", () => resolve());
107
+ });
108
+
109
+ // TODO: verify checksums
110
+ console.info("Installed Supabase CLI successfully");
111
+ }
112
+
113
+ await main();
package/dist/cli.js DELETED
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const gluegun_1 = require("gluegun");
5
- process.removeAllListeners('unhandledRejection');
6
- process.on('unhandledRejection', () => {
7
- process.exit(1);
8
- });
9
- gluegun_1.build('supabase').src(__dirname).create().run();
10
- //# sourceMappingURL=cli.js.map
package/dist/cli.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;AAEA,qCAA+B;AAE/B,OAAO,CAAC,kBAAkB,CAAC,oBAAoB,CAAC,CAAA;AAChD,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,GAAG,EAAE;IACpC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA;AAEF,eAAK,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAA"}
@@ -1,73 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.default = {
13
- name: 'eject',
14
- run: ({ filesystem: { exists }, template: { generate }, print: { colors: { highlight }, error, fancy, spin, }, prompt: { ask }, }) => __awaiter(void 0, void 0, void 0, function* () {
15
- if (exists('docker')) {
16
- error(`${highlight('docker')} exists in the current directory. Remove it to eject.`);
17
- process.exit(1);
18
- }
19
- const { kongPort, dbPort, mailPort } = yield ask([
20
- {
21
- type: 'input',
22
- name: 'kongPort',
23
- message: 'Port for Supabase URL:',
24
- initial: '8000',
25
- },
26
- {
27
- type: 'input',
28
- name: 'dbPort',
29
- message: 'Port for PostgreSQL database:',
30
- initial: '5432',
31
- },
32
- {
33
- type: 'input',
34
- name: 'mailPort',
35
- message: 'Port for email testing interface:',
36
- initial: '9000',
37
- },
38
- ]);
39
- const anonApiKey = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzdXBhYmFzZSIsImlhdCI6MTYwMzk2ODgzNCwiZXhwIjoyNTUwNjUzNjM0LCJyb2xlIjoiYW5vbiJ9.36fUebxgx1mcBo4s19v0SzqmzunP--hm_hep0uLX0ew';
40
- const serviceRoleApiKey = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzdXBhYmFzZSIsImlhdCI6MTYwMzk2ODgzNCwiZXhwIjoyNTUwNjUzNjM0LCJyb2xlIjoic2VydmljZV9yb2xlIn0.necIJaiP7X2T2QjGeV-FhpkizcNTX8HjDDBAxpgQTEI';
41
- const spinner = spin('Ejecting...');
42
- // Write templates
43
- yield Promise.all([
44
- 'kong/Dockerfile',
45
- 'kong/kong.yml',
46
- 'postgres/00-initial-schema.sql',
47
- 'postgres/Dockerfile',
48
- 'postgres/auth-schema.sql',
49
- 'docker-compose.yml',
50
- ].map((f) => generate({
51
- template: `init/docker/${f}`,
52
- target: `docker/${f}`,
53
- props: {
54
- kongPort,
55
- dbPort,
56
- mailPort,
57
- anonApiKey,
58
- serviceRoleApiKey,
59
- },
60
- }))).catch(() => {
61
- spinner.fail('Error writing Docker setup files.');
62
- process.exit(1);
63
- });
64
- spinner.succeed('Supabase Docker ejected.');
65
- fancy(`Supabase URL: ${highlight(`http://localhost:${kongPort}`)}
66
- Supabase Key (anon, public): ${highlight(anonApiKey)}
67
- Supabase Key (service_role, private): ${highlight(serviceRoleApiKey)}
68
- Database URL: ${highlight(`postgres://postgres:postgres@localhost:${dbPort}/postgres`)}
69
- Email testing interface URL: ${highlight(`http://localhost:${mailPort}`)}
70
- `);
71
- }),
72
- };
73
- //# sourceMappingURL=eject.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"eject.js","sourceRoot":"","sources":["../../src/commands/eject.ts"],"names":[],"mappings":";;;;;;;;;;;AAGA,kBAAe;IACb,IAAI,EAAE,OAAO;IACb,GAAG,EAAE,CAAO,EACV,UAAU,EAAE,EAAE,MAAM,EAAE,EACtB,QAAQ,EAAE,EAAE,QAAQ,EAAE,EACtB,KAAK,EAAE,EACL,MAAM,EAAE,EAAE,SAAS,EAAE,EACrB,KAAK,EACL,KAAK,EACL,IAAI,GACL,EACD,MAAM,EAAE,EAAE,GAAG,EAAE,GACA,EAAE,EAAE;QACnB,IAAI,MAAM,CAAC,QAAQ,CAAC,EAAE;YACpB,KAAK,CAAC,GAAG,SAAS,CAAC,QAAQ,CAAC,uDAAuD,CAAC,CAAA;YACpF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;SAChB;QAED,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,GAAG,CAAC;YAC/C;gBACE,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,UAAU;gBAChB,OAAO,EAAE,wBAAwB;gBACjC,OAAO,EAAE,MAAM;aAChB;YACD;gBACE,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,+BAA+B;gBACxC,OAAO,EAAE,MAAM;aAChB;YACD;gBACE,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,UAAU;gBAChB,OAAO,EAAE,mCAAmC;gBAC5C,OAAO,EAAE,MAAM;aAChB;SACF,CAAC,CAAA;QAEF,MAAM,UAAU,GACd,2KAA2K,CAAA;QAC7K,MAAM,iBAAiB,GACrB,sLAAsL,CAAA;QAExL,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,CAAA;QAEnC,kBAAkB;QAClB,MAAM,OAAO,CAAC,GAAG,CACf;YACE,iBAAiB;YACjB,eAAe;YACf,gCAAgC;YAChC,qBAAqB;YACrB,0BAA0B;YAC1B,oBAAoB;SACrB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACV,QAAQ,CAAC;YACP,QAAQ,EAAE,eAAe,CAAC,EAAE;YAC5B,MAAM,EAAE,UAAU,CAAC,EAAE;YACrB,KAAK,EAAE;gBACL,QAAQ;gBACR,MAAM;gBACN,QAAQ;gBACR,UAAU;gBACV,iBAAiB;aAClB;SACF,CAAC,CACH,CACF,CAAC,KAAK,CAAC,GAAG,EAAE;YACX,OAAO,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAA;YACjD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACjB,CAAC,CAAC,CAAA;QAEF,OAAO,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAA;QAC3C,KAAK,CAAC,iBAAiB,SAAS,CAAC,oBAAoB,QAAQ,EAAE,CAAC;+BACrC,SAAS,CAAC,UAAU,CAAC;wCACZ,SAAS,CAAC,iBAAiB,CAAC;gBACpD,SAAS,CAAC,0CAA0C,MAAM,WAAW,CAAC;+BACvD,SAAS,CAAC,oBAAoB,QAAQ,EAAE,CAAC;CACvE,CAAC,CAAA;IACA,CAAC,CAAA;CACF,CAAA"}
@@ -1,105 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const ignore_1 = __importDefault(require("ignore"));
16
- exports.default = {
17
- name: 'init',
18
- run: ({ filesystem: { append, read, exists, remove }, template: { generate }, print: { colors: { highlight }, error, fancy, spin, }, prompt: { ask }, system: { run, which }, }) => __awaiter(void 0, void 0, void 0, function* () {
19
- if (exists('.supabase')) {
20
- error(`Project already initialized. Remove ${highlight('.supabase')} to reinitialize.`);
21
- process.exit(1);
22
- }
23
- // Cleanup on Ctrl+C
24
- process.on('SIGINT', () => {
25
- remove('.supabase');
26
- error(`Aborted ${highlight('supabase init')}.`);
27
- process.exit(1);
28
- });
29
- const dockerCompose = which('docker-compose');
30
- if (!dockerCompose) {
31
- error(`Cannot find ${highlight('docker-compose')} executable in PATH.`);
32
- process.exit(1);
33
- }
34
- // Add .supabase to .gitignore
35
- const gitignore = read('.gitignore');
36
- if (gitignore) {
37
- const ig = ignore_1.default().add(gitignore);
38
- if (!ig.ignores('.supabase')) {
39
- append('.gitignore', '\n# Supabase\n.supabase\n');
40
- }
41
- }
42
- const { kongPort, dbPort, mailPort } = yield ask([
43
- {
44
- type: 'input',
45
- name: 'kongPort',
46
- message: 'Port for Supabase URL:',
47
- initial: '8000',
48
- },
49
- {
50
- type: 'input',
51
- name: 'dbPort',
52
- message: 'Port for PostgreSQL database:',
53
- initial: '5432',
54
- },
55
- {
56
- type: 'input',
57
- name: 'mailPort',
58
- message: 'Port for email testing interface:',
59
- initial: '9000',
60
- },
61
- ]);
62
- const anonApiKey = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzdXBhYmFzZSIsImlhdCI6MTYwMzk2ODgzNCwiZXhwIjoyNTUwNjUzNjM0LCJyb2xlIjoiYW5vbiJ9.36fUebxgx1mcBo4s19v0SzqmzunP--hm_hep0uLX0ew';
63
- const serviceRoleApiKey = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzdXBhYmFzZSIsImlhdCI6MTYwMzk2ODgzNCwiZXhwIjoyNTUwNjUzNjM0LCJyb2xlIjoic2VydmljZV9yb2xlIn0.necIJaiP7X2T2QjGeV-FhpkizcNTX8HjDDBAxpgQTEI';
64
- const spinner = spin('Initializing project...');
65
- // Write templates
66
- yield Promise.all([
67
- 'docker/kong/Dockerfile',
68
- 'docker/kong/kong.yml',
69
- 'docker/postgres/00-initial-schema.sql',
70
- 'docker/postgres/Dockerfile',
71
- 'docker/postgres/auth-schema.sql',
72
- 'docker/docker-compose.yml',
73
- 'README.md',
74
- ].map((f) => generate({
75
- template: `init/${f}`,
76
- target: `.supabase/${f}`,
77
- props: {
78
- kongPort,
79
- dbPort,
80
- mailPort,
81
- anonApiKey,
82
- serviceRoleApiKey,
83
- },
84
- }))).catch((err) => {
85
- remove('.supabase');
86
- spinner.fail(`Error writing Docker setup files: ${err.message}`);
87
- process.exit(1);
88
- });
89
- yield run('docker-compose --file .supabase/docker/docker-compose.yml build --no-cache && docker-compose --file .supabase/docker/docker-compose.yml --project-name supabase up --no-start --renew-anon-volumes', { trim: true }).catch((err) => {
90
- remove('.supabase');
91
- spinner.fail(`Error running docker-compose: ${err.stderr}`);
92
- process.exit(1);
93
- });
94
- spinner.succeed('Project initialized.');
95
- fancy(`Supabase URL: ${highlight(`http://localhost:${kongPort}`)}
96
- Supabase Key (anon, public): ${highlight(anonApiKey)}
97
- Supabase Key (service_role, private): ${highlight(serviceRoleApiKey)}
98
- Database URL: ${highlight(`postgres://postgres:postgres@localhost:${dbPort}/postgres`)}
99
- Email testing interface URL: ${highlight(`http://localhost:${mailPort}`)}
100
-
101
- Run ${highlight('supabase start')} to start local Supabase.
102
- `);
103
- }),
104
- };
105
- //# sourceMappingURL=init.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"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"}
@@ -1,32 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.default = {
13
- name: 'start',
14
- run: ({ filesystem: { exists }, print: { colors: { highlight }, error, spin, }, system: { run, which }, }) => __awaiter(void 0, void 0, void 0, function* () {
15
- if (!exists('.supabase')) {
16
- error(`Cannot find ${highlight('.supabase')} in the current directory. Perhaps you meant to run ${highlight('supabase init')} first?`);
17
- process.exit(1);
18
- }
19
- const dockerCompose = which('docker-compose');
20
- if (!dockerCompose) {
21
- error(`Cannot find ${highlight('docker-compose')} executable in PATH.`);
22
- process.exit(1);
23
- }
24
- const spinner = spin('Starting local Supabase...');
25
- yield run('docker-compose --file .supabase/docker/docker-compose.yml --project-name supabase up --detach').catch(() => {
26
- spinner.fail('Error running docker-compose.');
27
- process.exit(1);
28
- });
29
- spinner.succeed('Started local Supabase.');
30
- }),
31
- };
32
- //# sourceMappingURL=start.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"start.js","sourceRoot":"","sources":["../../src/commands/start.ts"],"names":[],"mappings":";;;;;;;;;;;AAEA,kBAAe;IACb,IAAI,EAAE,OAAO;IACb,GAAG,EAAE,CAAO,EACV,UAAU,EAAE,EAAE,MAAM,EAAE,EACtB,KAAK,EAAE,EACL,MAAM,EAAE,EAAE,SAAS,EAAE,EACrB,KAAK,EACL,IAAI,GACL,EACD,MAAM,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,GACP,EAAE,EAAE;QACnB,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE;YACxB,KAAK,CACH,eAAe,SAAS,CACtB,WAAW,CACZ,uDAAuD,SAAS,CAAC,eAAe,CAAC,SAAS,CAC5F,CAAA;YACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;SAChB;QAED,MAAM,aAAa,GAAG,KAAK,CAAC,gBAAgB,CAAC,CAAA;QAC7C,IAAI,CAAC,aAAa,EAAE;YAClB,KAAK,CAAC,eAAe,SAAS,CAAC,gBAAgB,CAAC,sBAAsB,CAAC,CAAA;YACvE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;SAChB;QAED,MAAM,OAAO,GAAG,IAAI,CAAC,4BAA4B,CAAC,CAAA;QAElD,MAAM,GAAG,CACP,+FAA+F,CAChG,CAAC,KAAK,CAAC,GAAG,EAAE;YACX,OAAO,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAA;YAC7C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACjB,CAAC,CAAC,CAAA;QAEF,OAAO,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAA;IAC5C,CAAC,CAAA;CACF,CAAA"}
@@ -1,32 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.default = {
13
- name: 'stop',
14
- run: ({ filesystem: { exists }, print: { colors: { highlight }, error, spin, }, system: { run, which }, }) => __awaiter(void 0, void 0, void 0, function* () {
15
- if (!exists('.supabase')) {
16
- error(`Cannot find ${highlight('.supabase')} in the current directory. Perhaps you meant to run ${highlight('supabase init')} first?`);
17
- process.exit(1);
18
- }
19
- const dockerCompose = which('docker-compose');
20
- if (!dockerCompose) {
21
- error(`Cannot find ${highlight('docker-compose')} executable in PATH.`);
22
- process.exit(1);
23
- }
24
- const spinner = spin('Stopping local Supabase...');
25
- yield run('docker-compose --file .supabase/docker/docker-compose.yml --project-name supabase stop').catch(() => {
26
- spinner.fail('Error running docker-compose.');
27
- process.exit(1);
28
- });
29
- spinner.succeed('Stopped local Supabase.');
30
- }),
31
- };
32
- //# sourceMappingURL=stop.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stop.js","sourceRoot":"","sources":["../../src/commands/stop.ts"],"names":[],"mappings":";;;;;;;;;;;AAEA,kBAAe;IACb,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,CAAO,EACV,UAAU,EAAE,EAAE,MAAM,EAAE,EACtB,KAAK,EAAE,EACL,MAAM,EAAE,EAAE,SAAS,EAAE,EACrB,KAAK,EACL,IAAI,GACL,EACD,MAAM,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,GACP,EAAE,EAAE;QACnB,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE;YACxB,KAAK,CACH,eAAe,SAAS,CACtB,WAAW,CACZ,uDAAuD,SAAS,CAAC,eAAe,CAAC,SAAS,CAC5F,CAAA;YACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;SAChB;QAED,MAAM,aAAa,GAAG,KAAK,CAAC,gBAAgB,CAAC,CAAA;QAC7C,IAAI,CAAC,aAAa,EAAE;YAClB,KAAK,CAAC,eAAe,SAAS,CAAC,gBAAgB,CAAC,sBAAsB,CAAC,CAAA;YACvE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;SAChB;QAED,MAAM,OAAO,GAAG,IAAI,CAAC,4BAA4B,CAAC,CAAA;QAElD,MAAM,GAAG,CACP,wFAAwF,CACzF,CAAC,KAAK,CAAC,GAAG,EAAE;YACX,OAAO,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAA;YAC7C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACjB,CAAC,CAAC,CAAA;QAEF,OAAO,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAA;IAC5C,CAAC,CAAA;CACF,CAAA"}
@@ -1,50 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.default = {
13
- name: 'supabase',
14
- run: ({ meta: { version }, parameters: { options }, print: { error, info, fancy, colors: { bold, green, muted, highlight }, }, }) => __awaiter(void 0, void 0, void 0, function* () {
15
- const printHelp = () => fancy(`${muted(`Supabase CLI ${version()}`)}
16
-
17
- ${bold(`${green('ϟ')} supabase`)} [options] [<command>]
18
-
19
- Commands:
20
-
21
- init Initialize project
22
- start Start local Supabase
23
- stop Stop local Supabase
24
- eject Create a ${highlight('docker')} directory with the Docker setup for Supabase.
25
- See ${highlight('https://supabase.io/docs/guides/self-hosting')} for details.
26
-
27
- Options:
28
-
29
- -h, --help Show usage information
30
- -v, --version Show version number
31
- `);
32
- for (const opt in options) {
33
- if (opt === 'h' || opt === 'help') {
34
- printHelp();
35
- return;
36
- }
37
- if (opt === 'v' || opt === 'version') {
38
- info(version());
39
- return;
40
- }
41
- // unrecognized opt
42
- printHelp();
43
- error(`Unknown or unexpected option: ${opt}.`);
44
- process.exit(1);
45
- }
46
- // options.length === 0
47
- printHelp();
48
- }),
49
- };
50
- //# sourceMappingURL=supabase.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"supabase.js","sourceRoot":"","sources":["../../src/commands/supabase.ts"],"names":[],"mappings":";;;;;;;;;;;AAEA,kBAAe;IACb,IAAI,EAAE,UAAU;IAChB,GAAG,EAAE,CAAO,EACV,IAAI,EAAE,EAAE,OAAO,EAAE,EACjB,UAAU,EAAE,EAAE,OAAO,EAAE,EACvB,KAAK,EAAE,EACL,KAAK,EACL,IAAI,EACJ,KAAK,EACL,MAAM,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,GAC1C,GACc,EAAE,EAAE;QACnB,MAAM,SAAS,GAAG,GAAG,EAAE,CACrB,KAAK,CAAC,GAAG,KAAK,CAAC,gBAAgB,OAAO,EAAE,EAAE,CAAC;;IAE7C,IAAI,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC;;;;;;;qCAOG,SAAS,CACxC,QAAQ,CACT;gCAC2B,SAAS,CACb,8CAA8C,CAC/C;;;;;;CAM1B,CAAC,CAAA;QAEE,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE;YACzB,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,MAAM,EAAE;gBACjC,SAAS,EAAE,CAAA;gBACX,OAAM;aACP;YAED,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,SAAS,EAAE;gBACpC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAA;gBACf,OAAM;aACP;YAED,mBAAmB;YACnB,SAAS,EAAE,CAAA;YACX,KAAK,CAAC,iCAAiC,GAAG,GAAG,CAAC,CAAA;YAC9C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;SAChB;QAED,uBAAuB;QACvB,SAAS,EAAE,CAAA;IACb,CAAC,CAAA;CACF,CAAA"}
@@ -1,12 +0,0 @@
1
- > Why do I have a directory named ".supabase" in my project?
2
-
3
- The ".supabase" directory is created by the Supabase CLI.
4
-
5
- > What does the "docker" directory contain?
6
-
7
- It contains the Docker Compose file and build files for running Supabase locally.
8
-
9
- > Should I commit the ".supabase" directory?
10
-
11
- No, you should not share the ".supabase" directory with anyone.
12
- Upon creation, it will be automatically added to your ".gitignore" file.
@@ -1,94 +0,0 @@
1
- version: '3.6'
2
- services:
3
- kong:
4
- container_name: supabase-kong
5
- build:
6
- context: ./kong
7
- environment:
8
- KONG_DECLARATIVE_CONFIG: /var/lib/kong/kong.yml
9
- KONG_PLUGINS: request-transformer,cors,key-auth,http-log
10
- KONG_DNS_ORDER: LAST,A,CNAME
11
- ports:
12
- - <%= props.kongPort %>:8000/tcp
13
- auth:
14
- container_name: supabase-auth
15
- image: supabase/gotrue:latest
16
- environment:
17
- GOTRUE_JWT_SECRET: super-secret-jwt-token-with-at-least-32-characters-long
18
- GOTRUE_JWT_AUD: authenticated
19
- GOTRUE_JWT_EXP: 3600
20
- GOTRUE_JWT_DEFAULT_GROUP_NAME: authenticated
21
- GOTRUE_DB_DRIVER: postgres
22
- DB_NAMESPACE: auth
23
- API_EXTERNAL_URL: http://localhost:8000
24
- GOTRUE_API_HOST: auth
25
- PORT: 9999
26
- GOTRUE_DISABLE_SIGNUP: 'false'
27
- GOTRUE_SITE_URL: http://localhost:8000
28
- GOTRUE_SMTP_HOST: mail
29
- GOTRUE_SMTP_PORT: 2500
30
- GOTRUE_SMTP_USER: GOTRUE_SMTP_USER
31
- GOTRUE_SMTP_PASS: GOTRUE_SMTP_PASS
32
- GOTRUE_SMTP_ADMIN_EMAIL: admin@email.com
33
- GOTRUE_MAILER_AUTOCONFIRM: 'false'
34
- GOTRUE_MAILER_SUBJECTS_CONFIRMATION: Confirm Your Signup
35
- GOTRUE_MAILER_SUBJECTS_INVITE: You have been invited
36
- GOTRUE_MAILER_SUBJECTS_MAGIC_LINK: Your Magic Link
37
- GOTRUE_MAILER_SUBJECTS_RECOVERY: Reset Your Password
38
- GOTRUE_MAILER_URLPATHS_CONFIRMATION: /auth/v1/verify
39
- GOTRUE_MAILER_URLPATHS_INVITE: /auth/v1/verify
40
- GOTRUE_MAILER_URLPATHS_RECOVERY: /auth/v1/verify
41
- GOTRUE_LOG_LEVEL: DEBUG
42
- GOTRUE_OPERATOR_TOKEN: super-secret-operator-token
43
- DATABASE_URL: postgres://postgres:postgres@db:5432/postgres?sslmode=disable
44
- depends_on:
45
- - db
46
- - mail
47
- rest:
48
- container_name: supabase-rest
49
- image: postgrest/postgrest:latest
50
- depends_on:
51
- - db
52
- restart: always
53
- environment:
54
- PGRST_DB_URI: postgres://postgres:postgres@db:5432/postgres
55
- PGRST_DB_SCHEMA: public
56
- PGRST_DB_ANON_ROLE: postgres
57
- PGRST_JWT_SECRET: super-secret-jwt-token-with-at-least-32-characters-long
58
- realtime:
59
- container_name: supabase-realtime
60
- image: supabase/realtime:latest
61
- depends_on:
62
- - db
63
- restart: on-failure
64
- environment:
65
- DB_HOST: db
66
- DB_NAME: postgres
67
- DB_USER: postgres
68
- DB_PASSWORD: postgres
69
- DB_PORT: 5432
70
- PORT: 4000
71
- HOSTNAME: localhost
72
- # Disable JWT Auth locally. The JWT_SECRET will be ignored.
73
- SECURE_CHANNELS: 'false'
74
- JWT_SECRET: super-secret-jwt-token-with-at-least-32-characters-long
75
- db:
76
- container_name: supabase-db
77
- build:
78
- context: ./postgres
79
- ports:
80
- - <%= props.dbPort %>:5432
81
- command:
82
- - postgres
83
- - -c
84
- - wal_level=logical
85
- environment:
86
- POSTGRES_DB: postgres
87
- POSTGRES_USER: postgres
88
- POSTGRES_PASSWORD: postgres
89
- POSTGRES_PORT: 5432
90
- mail:
91
- container_name: supabase-mail
92
- image: inbucket/inbucket:stable
93
- ports:
94
- - <%= props.mailPort %>:9000
@@ -1,10 +0,0 @@
1
- FROM kong:2.1
2
-
3
- COPY kong.yml /var/lib/kong/kong.yml
4
-
5
- # Run time values
6
- ENV KONG_DATABASE=off
7
- ENV KONG_PLUGINS=request-transformer,cors,key-auth
8
- ENV KONG_DECLARATIVE_CONFIG=/var/lib/kong/kong.yml
9
-
10
- EXPOSE 8000
@@ -1,76 +0,0 @@
1
- _format_version: '1.1'
2
- services:
3
- - name: auth-v1-open
4
- _comment: 'GoTrue: /auth/v1/verify* -> http://auth:9999/verify*'
5
- url: http://auth:9999/verify
6
- routes:
7
- - name: auth-v1-open
8
- strip_path: true
9
- paths:
10
- - /auth/v1/verify
11
- plugins:
12
- - name: cors
13
- - name: auth-v1-callback
14
- _comment: 'GoTrue: /auth/v1/callback* -> http://auth:9999/callback*'
15
- url: http://auth:9999/callback
16
- routes:
17
- - name: auth-v1-callback
18
- strip_path: true
19
- paths:
20
- - /auth/v1/callback
21
- plugins:
22
- - name: cors
23
- - name: auth-v1-authorize
24
- _comment: 'GoTrue: /auth/v1/authorize* -> http://auth:9999/authorize*'
25
- url: http://auth:9999/authorize
26
- routes:
27
- - name: auth-v1-authorize
28
- strip_path: true
29
- paths:
30
- - /auth/v1/authorize
31
- plugins:
32
- - name: cors
33
- - name: auth-v1
34
- _comment: 'GoTrue: /auth/v1/* -> http://auth:9999/*'
35
- url: http://auth:9999/
36
- routes:
37
- - name: auth-v1
38
- strip_path: true
39
- paths:
40
- - /auth/v1/
41
- plugins:
42
- - name: cors
43
- - name: key-auth
44
- config:
45
- hide_credentials: true
46
- - name: rest-v1
47
- _comment: 'PosgREST: /rest/v1/* -> http://rest:3000/*'
48
- url: http://rest:3000/
49
- routes:
50
- - name: rest-v1-all
51
- strip_path: true
52
- paths:
53
- - /rest/v1/
54
- plugins:
55
- - name: cors
56
- - name: key-auth
57
- config:
58
- hide_credentials: true
59
- - name: realtime-v1
60
- _comment: 'Realtime: /realtime/v1/* -> ws://realtime:4000/socket/*'
61
- url: http://realtime:4000/socket/
62
- routes:
63
- - name: realtime-v1-all
64
- strip_path: true
65
- paths:
66
- - /realtime/v1/
67
- plugins:
68
- - name: cors
69
- - name: key-auth
70
- config:
71
- hide_credentials: true
72
- consumers:
73
- - username: 'private-key'
74
- keyauth_credentials:
75
- - key: <%= props.anonApiKey %>
76
- - key: <%= props.serviceRoleApiKey %>
@@ -1,26 +0,0 @@
1
-
2
-
3
- -- Set up reatime
4
- create publication supabase_realtime for all tables;
5
-
6
- -- Extension namespacing
7
- create schema extensions;
8
- create extension if not exists "uuid-ossp" with schema extensions;
9
- create extension if not exists pgcrypto with schema extensions;
10
- create extension if not exists pgjwt with schema extensions;
11
-
12
- -- Developer roles
13
- create role anon nologin noinherit;
14
- create role authenticated nologin noinherit; -- "logged in" user: web_user, app_user, etc
15
- create role service_role nologin noinherit bypassrls; -- allow developers to create JWT's that bypass their policies
16
-
17
- create user authenticator noinherit;
18
- grant anon to authenticator;
19
- grant authenticated to authenticator;
20
- grant service_role to authenticator;
21
-
22
- grant usage on schema public to postgres, anon, authenticated, service_role;
23
- alter default privileges in schema public grant all on tables to postgres, anon, authenticated, service_role;
24
- alter default privileges in schema public grant all on functions to postgres, anon, authenticated, service_role;
25
- alter default privileges in schema public grant all on sequences to postgres, anon, authenticated, service_role;
26
-
@@ -1,12 +0,0 @@
1
- FROM supabase/postgres:0.13.0
2
-
3
- COPY 00-initial-schema.sql /docker-entrypoint-initdb.d/00-initial-schema.sql
4
- COPY auth-schema.sql /docker-entrypoint-initdb.d/auth-schema.sql
5
-
6
- # Run time values
7
- ENV POSTGRES_DB=postgres
8
- ENV POSTGRES_USER=postgres
9
- ENV POSTGRES_PASSWORD=postgres
10
- ENV POSTGRES_PORT=5432
11
-
12
- EXPOSE 5432
@@ -1,91 +0,0 @@
1
-
2
- CREATE SCHEMA IF NOT EXISTS auth AUTHORIZATION postgres;
3
-
4
- -- auth.users definition
5
- CREATE TABLE auth.users (
6
- instance_id uuid NULL,
7
- id uuid NOT NULL,
8
- aud varchar(255) NULL,
9
- "role" varchar(255) NULL,
10
- email varchar(255) NULL,
11
- encrypted_password varchar(255) NULL,
12
- confirmed_at timestamptz NULL,
13
- invited_at timestamptz NULL,
14
- confirmation_token varchar(255) NULL,
15
- confirmation_sent_at timestamptz NULL,
16
- recovery_token varchar(255) NULL,
17
- recovery_sent_at timestamptz NULL,
18
- email_change_token varchar(255) NULL,
19
- email_change varchar(255) NULL,
20
- email_change_sent_at timestamptz NULL,
21
- last_sign_in_at timestamptz NULL,
22
- raw_app_meta_data jsonb NULL,
23
- raw_user_meta_data jsonb NULL,
24
- is_super_admin bool NULL,
25
- created_at timestamptz NULL,
26
- updated_at timestamptz NULL,
27
- CONSTRAINT users_pkey PRIMARY KEY (id)
28
- );
29
- CREATE INDEX users_instance_id_email_idx ON auth.users USING btree (instance_id, email);
30
- CREATE INDEX users_instance_id_idx ON auth.users USING btree (instance_id);
31
- -- auth.refresh_tokens definition
32
- CREATE TABLE auth.refresh_tokens (
33
- instance_id uuid NULL,
34
- id bigserial NOT NULL,
35
- "token" varchar(255) NULL,
36
- user_id varchar(255) NULL,
37
- revoked bool NULL,
38
- created_at timestamptz NULL,
39
- updated_at timestamptz NULL,
40
- CONSTRAINT refresh_tokens_pkey PRIMARY KEY (id)
41
- );
42
- CREATE INDEX refresh_tokens_instance_id_idx ON auth.refresh_tokens USING btree (instance_id);
43
- CREATE INDEX refresh_tokens_instance_id_user_id_idx ON auth.refresh_tokens USING btree (instance_id, user_id);
44
- CREATE INDEX refresh_tokens_token_idx ON auth.refresh_tokens USING btree (token);
45
- -- auth.instances definition
46
- CREATE TABLE auth.instances (
47
- id uuid NOT NULL,
48
- uuid uuid NULL,
49
- raw_base_config text NULL,
50
- created_at timestamptz NULL,
51
- updated_at timestamptz NULL,
52
- CONSTRAINT instances_pkey PRIMARY KEY (id)
53
- );
54
- -- auth.audit_log_entries definition
55
- CREATE TABLE auth.audit_log_entries (
56
- instance_id uuid NULL,
57
- id uuid NOT NULL,
58
- payload json NULL,
59
- created_at timestamptz NULL,
60
- CONSTRAINT audit_log_entries_pkey PRIMARY KEY (id)
61
- );
62
- CREATE INDEX audit_logs_instance_id_idx ON auth.audit_log_entries USING btree (instance_id);
63
- -- auth.schema_migrations definition
64
- CREATE TABLE auth.schema_migrations (
65
- "version" varchar(255) NOT NULL,
66
- CONSTRAINT schema_migrations_pkey PRIMARY KEY ("version")
67
- );
68
- INSERT INTO auth.schema_migrations (version)
69
- VALUES ('20171026211738'),
70
- ('20171026211808'),
71
- ('20171026211834'),
72
- ('20180103212743'),
73
- ('20180108183307'),
74
- ('20180119214651'),
75
- ('20180125194653');
76
- -- Gets the User ID from the request cookie
77
- create or replace function auth.uid() returns uuid as $$
78
- select nullif(current_setting('request.jwt.claim.sub', true), '')::uuid;
79
- $$ language sql stable;
80
- -- Gets the User Role from the request cookie
81
- create or replace function auth.role() returns text as $$
82
- select nullif(current_setting('request.jwt.claim.role', true), '')::text;
83
- $$ language sql stable;
84
- -- Gets the User Email from the request cookie
85
- create or replace function auth.email() returns text as $$
86
- select nullif(current_setting('request.jwt.claim.email', true), '')::text;
87
- $$ language sql stable;
88
- GRANT ALL PRIVILEGES ON SCHEMA auth TO postgres;
89
- GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA auth TO postgres;
90
- GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA auth TO postgres;
91
- ALTER ROLE postgres SET search_path = "$user", public, auth;