private void createSequence(String sequenceName, Schema schema) { Sequence sequence = new Sequence(); sequence.setName(sequenceName); sequence.setSchema(schema); schema.addDatabaseObject(sequence); }
@Override protected DatabaseObject snapshotObject(DatabaseObject example, DatabaseSnapshot snapshot) throws DatabaseException, InvalidExampleException { return new Schema(snapshot.getDatabase().getDefaultCatalogName(), snapshot.getDatabase().getDefaultSchemaName()).setDefault(true); }
String pkSchemaName = liquibasePkTable.getSchema().getName(); String pkTableName = normalizeTableName(liquibasePkTable, databaseSnapshot); targetFK.setToSchema(pkSchemaName);
String pkSchemaName = liquibasePkTable.getSchema().getName(); String pkTableName = normalizeTableName(liquibasePkTable, databaseSnapshot); targetFK.setToSchema(pkSchemaName);
@Override protected void addTo(DatabaseObject foundObject, DatabaseSnapshot snapshot) throws DatabaseException, InvalidExampleException { if (!snapshot.getSnapshotControl().shouldInclude(Table.class)) { return; } if (foundObject instanceof Schema) { Schema schema = (Schema) foundObject; HibernateDatabase database = (HibernateDatabase) snapshot.getDatabase(); Configuration cfg = database.getConfiguration(); Iterator<org.hibernate.mapping.Table> tableMappings = cfg.getTableMappings(); while (tableMappings.hasNext()) { org.hibernate.mapping.Table hibernateTable = tableMappings.next(); if (hibernateTable.isPhysicalTable()) { Table table = new Table().setName(hibernateTable.getName()); table.setSchema(schema); LOG.info("Found table " + table.getName()); schema.addDatabaseObject(table); } } } } }
table.setSchema(schema); LOG.info("Found table " + table.getName()); schema.addDatabaseObject(snapshotObject(table, snapshot)); Table idTable = tableIdGenerator.snapshot(ig); idTable.setSchema(schema); schema.addDatabaseObject(snapshotObject(idTable, snapshot)); break; table.setSchema(schema); LOG.info("Found table " + table.getName()); schema.addDatabaseObject(snapshotObject(table, snapshot));
table.getSchema().addDatabaseObject(fk);