mirror of
https://github.com/Snowflake-Labs/dlsync.git
synced 2025-12-18 00:51:27 +00:00
Updated parser to warn migration if no valid migration was found
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
---version: 0, author: DlSync
|
||||
CREATE OR REPLACE ALERT ${EXAMPLE_DB}.${MAIN_SCHEMA}.DISCOUNTS_ALERT
|
||||
SCHEDULE = '1 minute'
|
||||
SCHEDULE = '600 minute'
|
||||
IF( EXISTS(
|
||||
SELECT DISCOUNT_RATE FROM ${EXAMPLE_DB}.${MAIN_SCHEMA}.DISCOUNTS WHERE DISCOUNT_RATE>0.1))
|
||||
THEN
|
||||
INSERT INTO DISCOUNT_RATE_EXCEEDED_HISTORY VALUES (current_timestamp());
|
||||
INSERT INTO DISCOUNT_RATE_EXCEEDED_HISTORY VALUES (current_timestamp());
|
||||
---rollback: DROP ALERT IF EXISTS ${EXAMPLE_DB}.${MAIN_SCHEMA}.DISCOUNTS_ALERT;
|
||||
---verify: SHOW ALERTS LIKE 'DISCOUNTS_ALERT' IN SCHEMA ${EXAMPLE_DB}.${MAIN_SCHEMA};
|
||||
@@ -79,6 +79,9 @@ public class SqlTokenizer {
|
||||
Set<Script> scripts = new HashSet<>();
|
||||
if(objectType.isMigration()) {
|
||||
List<Migration> migrations = SqlTokenizer.parseMigrationScripts(content);
|
||||
if(migrations.isEmpty()) {
|
||||
log.warn("Object type: {} is migration, but there are no migrations found in the file: {}", objectType, filePath);
|
||||
}
|
||||
for(Migration migration: migrations) {
|
||||
MigrationScript script = ScriptFactory.getMigrationScript(database, schema, objectType, objectName, migration);
|
||||
// Script script = new Script(database, schema, objectType, objectName, migration.getContent(), migration.getVersion(), migration.getAuthor(), migration.getRollback());
|
||||
|
||||
Reference in New Issue
Block a user