-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SDP-1147] Store the admin tables in the admin schema, instead of the public schema #266
Conversation
stellar-disbursement-platform-backend-preview is available here: |
b1b9ed4
to
61d4709
Compare
stellar-disbursement-platform-backend-preview is available here: |
stellar-disbursement-platform-backend-preview is available here: |
stellar-disbursement-platform-backend-preview is available here: |
stellar-disbursement-platform-backend-preview is available here: |
097ad99
to
53db3a2
Compare
stellar-disbursement-platform-backend-preview is available here: |
### What Update the single-tenant to multi-tenant migration guide with the following changes: * Update the status requirements saying that the only payments/submitter_transactions statuses that need to be solved before the migration are PENDING/PROCESSING * Reorganize the content * Add extra sections with more info * Include new commands and SQL queries to make the migration easier. * Add TODOs: - [x] stellar/stellar-disbursement-platform-backend#262 - [ ] stellar/stellar-disbursement-platform-backend#266 - [ ] https://stellarorg.atlassian.net/browse/SDP-1148
stellar-disbursement-platform-backend-preview is available here: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! This is great! Thank you for all the extra simplifications of the schemas
cmd/db/db.go
Outdated
@@ -203,8 +203,19 @@ func (c *DatabaseCommand) adminMigrationsCmd(ctx context.Context, globalOptions | |||
} | |||
|
|||
executeMigrationsFn := func(ctx context.Context, dir migrate.MigrationDirection, count int) error { | |||
if err := ExecuteMigrations(ctx, globalOptions.DatabaseURL, dir, count, migrations.AdminMigrationRouter); err != nil { | |||
return fmt.Errorf("executing migrations for %s: %w", adminCmd.Name(), err) | |||
dbURL, err := router.GetDNSForAdmin(globalOptions.DatabaseURL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not related to this PR, but I believe this should be switched to GetDSNForAdmin()
CREATE TYPE tenant_status AS ENUM ('TENANT_CREATED', 'TENANT_PROVISIONED', 'TENANT_ACTIVATED', 'TENANT_DEACTIVATED'); | ||
|
||
CREATE TABLE tenants | ||
( | ||
id VARCHAR(36) PRIMARY KEY DEFAULT public.uuid_generate_v4(), | ||
name text NOT NULL, | ||
email_sender_type email_sender_type DEFAULT 'DRY_RUN'::email_sender_type, | ||
sms_sender_type sms_sender_type DEFAULT 'DRY_RUN'::sms_sender_type, | ||
enable_mfa boolean DEFAULT true, | ||
enable_recaptcha boolean DEFAULT true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that we're simplifying the schema, it would be good to remove enable_mfa
and enable_recaptcha
. They were dropped in 2024-03-01.alter-tenants-table-drop-enable-mfa-and-recaptcha.sql
CREATE TYPE tenant_status AS ENUM ('TENANT_CREATED', 'TENANT_PROVISIONED', 'TENANT_ACTIVATED', 'TENANT_DEACTIVATED'); | ||
|
||
CREATE TABLE tenants | ||
( | ||
id VARCHAR(36) PRIMARY KEY DEFAULT public.uuid_generate_v4(), | ||
name text NOT NULL, | ||
email_sender_type email_sender_type DEFAULT 'DRY_RUN'::email_sender_type, | ||
sms_sender_type sms_sender_type DEFAULT 'DRY_RUN'::sms_sender_type, | ||
enable_mfa boolean DEFAULT true, | ||
enable_recaptcha boolean DEFAULT true, | ||
cors_allowed_origins text[] NULL, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cors_allowed_origins
was dropped in 2023-11-14.0.drop-unused-cors-column.sql
} | ||
|
||
// Helper function to set the search_path for the schema. | ||
func getDSNWithFixedSchema(dataSourceName, schemaName string) (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😎 Cool!
bf2a268
to
f479c5e
Compare
stellar-disbursement-platform-backend-preview is available here: |
b51454d
to
98ae547
Compare
…move occurrences of email_sender_type and sms_sender_type.
…move occurrences of enable_mfa and enable_recaptcha.
f479c5e
to
6b0e068
Compare
stellar-disbursement-platform-backend-preview is available here: |
* [SDP-1139] sdp: add SDP multi-tenant migration doc (#394) * feat: add SDP multi-tenant migration doc * chore: address PR comments * [SDP-1056] sdp: add SDP Admin API spec (#397) * feat: add SDP Admin API spec * chore: address PR comments * fix: remove distribution_account field * SDP-1054 update design and architecture docs * Update the "Getting Started" section. * chore: update SDP docs build (#440) When running the `yarn api` these files are rebuilt due to a new authenticate method added (`Basic Auth`). This PR only updates these files to the latest version. The changes are related to this #397. * [SDP-1100] Default tenant endpoint (#455) This PR adds the default tenant endpoint that sets a tenant as the default in the system. --------- Authored-by: Caio Teixeira <caio.xd63@hotmail.com> * [SDP-1151] Update single-tenant to multi-tenant migration guide (#496) ### What Update the single-tenant to multi-tenant migration guide with the following changes: * Update the status requirements saying that the only payments/submitter_transactions statuses that need to be solved before the migration are PENDING/PROCESSING * Reorganize the content * Add extra sections with more info * Include new commands and SQL queries to make the migration easier. * Add TODOs: - [x] stellar/stellar-disbursement-platform-backend#262 - [ ] stellar/stellar-disbursement-platform-backend#266 - [ ] https://stellarorg.atlassian.net/browse/SDP-1148 * [SDP-1151] Polish the single-tenant to multi-tenant migration guide (#511) * [SDP-1157] add `Configuring the SDP` page (#512) * SDP-1157 adding `Configuring the SDP` page * SDP-1157 adding `Configuring the SDP` page * SDP-1157 address PR comments * SDP-1157 move sdp API under api-reference folder * Fix broken link * Change architecture diagram * Update instructions with the updated field name. * add tenant resolution and multi-tenant subdomain info. (#578) * add tenant resolution and multi-tenant subdomain info. * address PR comments * Enforce the necessity to include the home domain in the SDP SEP-10 challenge GET request (#654) ### Why To keep the docs up to date with the code. This is now required in the multitenant instance. * [SDP] Polish the docs for the multitenant 2.0.0 release (#656) ### Changes - Add the missing DELETE /tenants/:id API documentation - Update the request and response bodies in the /tenants API. - Updated the checksum on the .api.mdx files by running `yarn api` --------- Co-authored-by: Caio Teixeira <caio.xd63@hotmail.com> Co-authored-by: Erica <erica.liu@stellar.org> Co-authored-by: Marcelo Salloum dos Santos <marcelosalloum@gmail.com> Co-authored-by: Marcelo Salloum <marcelo@stellar.org>
* Changing "Soroban CLI" to "Stellar CLI" * Update soroban-cli version. (#634) * Update some CLI commands * Remove Deadlink - Stellar Authenticator (#637) * Update setup.mdx (#644) The soroban-cli version in this doc is outdated and will give the following error when invoking a deployed contract: "error: xdr processing error: xdr value invalid" As specified here an update of the CLI version is needed: https://stellar.org/blog/developers/protocol-21-upgrade-guide * Update smart-contract-deployment.mdx (#645) The it is an issue in the vault contract's withdraw function which will incorrectly update the value of Reserve. In this line let balance = get_token_balance(&e); balance is updated AFTER the transfer of the user deposit + yield has already occurred. Thus the balance fetched is already the current "reserve" balance of the Vault. So when the following line of code executes: put_reserve(&e, balance - amount); the Reserve is updated to the balance of the Vault contract - the amount withdrawn by the user, so it will count the withdrawn 2 times. Indeed when following the test the result from "get_rsrvs" in the first scenario will be : "-1" Initial balance of the Vault: 200 - amount: 100 + yield: 1 (from the transfer) - amount: 100 (from the put_reserve input). For further improvements the get_rsrvs should only account for the amount of reward tokens that the vault is holding which can be useful to obtain the deposited amount (vault balance - reserves). Additionally the --wasm argument in the "invoke" command is not needed and it was removed. * [SDP-1054] Updating Stellar Docs for SDP multi-tenant (#407) * [SDP-1139] sdp: add SDP multi-tenant migration doc (#394) * feat: add SDP multi-tenant migration doc * chore: address PR comments * [SDP-1056] sdp: add SDP Admin API spec (#397) * feat: add SDP Admin API spec * chore: address PR comments * fix: remove distribution_account field * SDP-1054 update design and architecture docs * Update the "Getting Started" section. * chore: update SDP docs build (#440) When running the `yarn api` these files are rebuilt due to a new authenticate method added (`Basic Auth`). This PR only updates these files to the latest version. The changes are related to this #397. * [SDP-1100] Default tenant endpoint (#455) This PR adds the default tenant endpoint that sets a tenant as the default in the system. --------- Authored-by: Caio Teixeira <caio.xd63@hotmail.com> * [SDP-1151] Update single-tenant to multi-tenant migration guide (#496) ### What Update the single-tenant to multi-tenant migration guide with the following changes: * Update the status requirements saying that the only payments/submitter_transactions statuses that need to be solved before the migration are PENDING/PROCESSING * Reorganize the content * Add extra sections with more info * Include new commands and SQL queries to make the migration easier. * Add TODOs: - [x] stellar/stellar-disbursement-platform-backend#262 - [ ] stellar/stellar-disbursement-platform-backend#266 - [ ] https://stellarorg.atlassian.net/browse/SDP-1148 * [SDP-1151] Polish the single-tenant to multi-tenant migration guide (#511) * [SDP-1157] add `Configuring the SDP` page (#512) * SDP-1157 adding `Configuring the SDP` page * SDP-1157 adding `Configuring the SDP` page * SDP-1157 address PR comments * SDP-1157 move sdp API under api-reference folder * Fix broken link * Change architecture diagram * Update instructions with the updated field name. * add tenant resolution and multi-tenant subdomain info. (#578) * add tenant resolution and multi-tenant subdomain info. * address PR comments * Enforce the necessity to include the home domain in the SDP SEP-10 challenge GET request (#654) ### Why To keep the docs up to date with the code. This is now required in the multitenant instance. * [SDP] Polish the docs for the multitenant 2.0.0 release (#656) ### Changes - Add the missing DELETE /tenants/:id API documentation - Update the request and response bodies in the /tenants API. - Updated the checksum on the .api.mdx files by running `yarn api` --------- Co-authored-by: Caio Teixeira <caio.xd63@hotmail.com> Co-authored-by: Erica <erica.liu@stellar.org> Co-authored-by: Marcelo Salloum dos Santos <marcelosalloum@gmail.com> Co-authored-by: Marcelo Salloum <marcelo@stellar.org> * Rewriting scaling documentation (#659) * rpc: add getFeeStats method documentation (#660) * rpc: add getFeeStats method * Address review feedback * Remove unneeded stop * Add some description updates --------- Co-authored-by: Jane Wang <janewang@Janes-MacBook-Pro.local> * Soroban RPC: Add document for getVersionInfo RPC (#661) * Add document for getVersionInfo RPC * update info * Add captive core info * Add a table of hardware requirements for various node types (#568) * add a doc with a requirements comparison table * add some sidebar content for new-ish section * adjust some heading config for platforms pages * Fix command for adding new networks. (#667) * Adding Tokens Overview (wayfinding) (#570) * Adding Tokens Overview (wayfinding) * Update docs/smart-contracts/tokens/wayfinding.mdx Co-authored-by: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> * Update docs/smart-contracts/tokens/wayfinding.mdx Co-authored-by: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> * Update docs/smart-contracts/tokens/wayfinding.mdx Co-authored-by: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> * Update docs/smart-contracts/tokens/wayfinding.mdx Co-authored-by: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> * Update docs/smart-contracts/tokens/wayfinding.mdx Co-authored-by: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> * Update docs/smart-contracts/tokens/wayfinding.mdx Co-authored-by: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> * Update docs/smart-contracts/tokens/wayfinding.mdx Co-authored-by: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> * formatting * more updates * update copy * couple nits * Update docs/smart-contracts/tokens/wayfinding.mdx Co-authored-by: Jake Urban <10968980+JakeUrban@users.noreply.github.com> * update wording * update note * Update docs/smart-contracts/tokens/wayfinding.mdx Co-authored-by: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> * G & C addresses * Update docs/smart-contracts/tokens/wayfinding.mdx Co-authored-by: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> * Update docs/smart-contracts/tokens/wayfinding.mdx Co-authored-by: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> * Update docs/smart-contracts/tokens/wayfinding.mdx Co-authored-by: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> * Update docs/smart-contracts/tokens/wayfinding.mdx Co-authored-by: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> * Update docs/smart-contracts/tokens/wayfinding.mdx Co-authored-by: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> * wording * formatting --------- Co-authored-by: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Co-authored-by: Jake Urban <10968980+JakeUrban@users.noreply.github.com> * Categorize Learn Section (#646) * Categorize Learn Section * moving things around * fix links * more links * mas links * beaucoup links * mais links * authorization heading fix * message * little nits * Fix link (#675) * Learn section redirects (#678) * Add examples of invoking contracts using Python SDK and Java SDK. (#643) * Add examples of calling contracts using Python SDK and Java SDK * rename file * fix js example * Add hubble diagrams and data dicts (#670) Add hubble diagrams and data dicts * Add Passkey Library session to meeting notes (#681) * update meeting notes * Update 2024-06-13.mdx * Update 2024-06-13.mdx * Update 2024-06-13.mdx --------- Co-authored-by: Tyler van der Hoeven <hi@tyvdh.com> * Add Ortege to Block Explorers (#671) * Add Ortege to Block Explorers * Update developer-tools.mdx * Update Software Versions for Protocol 21: Mainnet (#685) * Update Software Versions for Protocol 21: Mainnet * adding versions back to be updated * rpc: Add `getTransactions` documentation (#636) * Add getTransactions documenation - 1 * Add getTransactions documentation - 2 * Add getTransactions documentation - 4 * Refactor Pagination changes * Refactor the params object in getTransactions examples * Change naming to only RPC * Change description of diagnosticEventsXdr * Add "items" * Update openrpc/src/methods/getTransactions.json Co-authored-by: George <Shaptic@users.noreply.github.com> * Update openrpc/src/schemas/Cursor.json Co-authored-by: George <Shaptic@users.noreply.github.com> * Update openrpc/src/schemas/Pagination.json Co-authored-by: George <Shaptic@users.noreply.github.com> * Small changes - 1 * Remove links - 1 * Remove links - 2 * Fix broken TOID link --------- Co-authored-by: George <Shaptic@users.noreply.github.com> * Updates to Getting Started Docs (#674) * Update soroban output to current 21.x state * Fix naming for HelloContractClient * Consistent directory names * formatting and link --------- Co-authored-by: Bri <92327786+briwylde08@users.noreply.github.com> * Add more detail to overlay survey instructions (#653) * Add more detail to overlay survey instructions This change adds some additional instructions to the overlay survey section of the admin guide. Specifically, it adds: * Instructions on how to use the overlay survey script. * Information about the `nonce` field in the "start/stop collecting" messages. * Explicit instructions on how to opt-out of the survey. * Recommendations for collecting phase durations. * Small tweaks to fix grammar/formatting/example errors found while editing the section * Add links * Add admin-guide for hubble (#669) Add admin-guide for hubble * typo fix in cli guid (#693) * Update docs/smart-contracts/getting-started/setup.mdx Co-authored-by: Nando Vieira <me@fnando.com> * Changing "Soroban CLI" to "Stellar CLI" * Update some CLI commands * Add more cli updates * Update to stellar cli * Fix path --------- Co-authored-by: Nando Vieira <me@fnando.com> Co-authored-by: Jane Wang <janewang@Janes-MacBook-Pro.local> Co-authored-by: Ricky Lindenhovius <1669379+xiv@users.noreply.github.com> Co-authored-by: FrankFourier <84725957+Frank-Fourier@users.noreply.github.com> Co-authored-by: Marwen Abid <marwen.abid@stellar.org> Co-authored-by: Caio Teixeira <caio.xd63@hotmail.com> Co-authored-by: Erica <erica.liu@stellar.org> Co-authored-by: Marcelo Salloum dos Santos <marcelosalloum@gmail.com> Co-authored-by: Marcelo Salloum <marcelo@stellar.org> Co-authored-by: Molly Karcher <molly@stellar.org> Co-authored-by: Alfonso Acosta <fons@syntacticsugar.consulting> Co-authored-by: Prit Sheth <124409873+psheth9@users.noreply.github.com> Co-authored-by: Elliot Voris <elliot@stellar.org> Co-authored-by: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Co-authored-by: Jake Urban <10968980+JakeUrban@users.noreply.github.com> Co-authored-by: Jun Luo <4catcode@gmail.com> Co-authored-by: chowbao <simon.chow765@gmail.com> Co-authored-by: Julian Martinez <73849597+Julian-dev28@users.noreply.github.com> Co-authored-by: Tyler van der Hoeven <hi@tyvdh.com> Co-authored-by: Aditya Vyas <adityavyas17@gmail.com> Co-authored-by: George <Shaptic@users.noreply.github.com> Co-authored-by: Pam S <pamela.selle@gmail.com> Co-authored-by: Brett Boston <bboston7@users.noreply.github.com> Co-authored-by: Rahul Soshte <rahul.soshte4771@gmail.com>
What
Store the admin tables in the admin schema, instead of the public schema.
Checklist:
Why
Addresses https://stellarorg.atlassian.net/browse/SDP-1147.
Known limitations
[TODO or N/A]
Checklist
PR Structure
Thoroughness
Configs and Secrets
values.yaml
file.pr-preview
,dev
,demo
,prd
).values.yaml
file.pr-preview secrets
,dev secrets
,demo secrets
,prd secrets
).Release
develop
ormain
after it's ready for production!Deployment