Skip to content
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

Upgrading scripts on empty database #2221

Open
xiaodani opened this issue Jun 22, 2023 · 1 comment
Open

Upgrading scripts on empty database #2221

xiaodani opened this issue Jun 22, 2023 · 1 comment

Comments

@xiaodani
Copy link

I am using apistudio standalone version with mysql.
I have followed the instructions here
https://www.apicur.io/studio/docs/switching-to-mysql-or-postgresql

I have also removed ExampleDS in the standalone-apicurio.xml

When I first ran apicurio with
./bin/standalone.sh -c standalone-apicurio.xml
Apicurio initialized the empty database that I created.

However, when I delete the database and run again, it tries to upgrade the empty database.
Is there anything else I should reset to let apicurio knows that the database is empty?

These are the logs I have gotten

2023-06-22 11:01:58,073 DEBUG [io.apicurio.hub.core.storage.jdbc.DataSourceResolver] (default task-5) Creating an instance of Datasource for injection
2023-06-22 11:01:58,084 DEBUG [io.apicurio.hub.core.storage.jdbc.JdbcStorage] (default task-5) JDBC Storage constructed successfully.
2023-06-22 11:01:58,210 DEBUG [io.apicurio.studio.shared.config.Configuration] (default task-5) Config Property: APICURIO_SHARE_FOR_EVERYONE/apicurio.share.for.everyone = false
2023-06-22 11:01:58,210 DEBUG [io.apicurio.studio.shared.config.Configuration] (default task-5) Config Property: APICURIO_HUB_STORAGE_JDBC_INIT/apicurio.hub.storage.jdbc.init = true
2023-06-22 11:01:58,210 DEBUG [io.apicurio.hub.core.storage.jdbc.JdbcStorage] (default task-5) Checking to see if the DB is initialized.
2023-06-22 11:01:58,345 DEBUG [io.apicurio.studio.shared.config.Configuration] (default task-5) Config Property: APICURIO_HUB_STORAGE_JDBC_TYPE/apicurio.hub.storage.jdbc.type = mysql5
2023-06-22 11:01:58,345 DEBUG [io.apicurio.hub.core.storage.jdbc.SqlStatementsProducer] (default task-5) Creating an instance of ISqlStatements for DB: mysql5
2023-06-22 11:01:58,346 DEBUG [io.apicurio.studio.shared.config.Configuration] (default task-5) Config Property: APICURIO_HUB_STORAGE_JDBC_TYPE/apicurio.hub.storage.jdbc.type = mysql5
2023-06-22 11:01:58,348 DEBUG [io.apicurio.studio.shared.config.Configuration] (default task-5) Config Property: APICURIO_SHARE_FOR_EVERYONE/apicurio.share.for.everyone = false
2023-06-22 11:01:58,417 DEBUG [io.apicurio.hub.core.storage.jdbc.JdbcStorage] (default task-5) Database was already initialized, skipping.
2023-06-22 11:01:58,417 DEBUG [io.apicurio.hub.core.storage.jdbc.JdbcStorage] (default task-5) Checking to see if the DB is up-to-date.
2023-06-22 11:01:58,430 DEBUG [io.apicurio.hub.core.storage.jdbc.JdbcStorage] (default task-5) Old database version detected, upgrading.
2023-06-22 11:01:58,430 INFO [io.apicurio.hub.core.storage.jdbc.JdbcStorage] (default task-5) Upgrading the Apicurio Hub API database.
2023-06-22 11:01:58,431 DEBUG [io.apicurio.studio.shared.config.Configuration] (default task-5) Config Property: APICURIO_HUB_STORAGE_JDBC_TYPE/apicurio.hub.storage.jdbc.type = mysql5
2023-06-22 11:01:58,432 INFO [io.apicurio.hub.core.storage.jdbc.JdbcStorage] (default task-5) Database type: mysql5
2023-06-22 11:01:58,432 INFO [io.apicurio.hub.core.storage.jdbc.JdbcStorage] (default task-5) From Version: 0
2023-06-22 11:01:58,432 INFO [io.apicurio.hub.core.storage.jdbc.JdbcStorage] (default task-5) To Version: 12

@xiaodani
Copy link
Author

I think the reason is because I am having multiple databases of apicurio and the checking of initialization is this

@Override public String isDatabaseInitialized() { return "SELECT count(*) AS count FROM information_schema.tables WHERE table_name = 'api_designs' LIMIT 1"; }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant