flyway
БесплатноБез исполняемых скриптовНе проверенFlyway database migrations for Spring Boot applications. Covers migration scripts, versioning, callbacks, and rollback strategies. Based on production…
от claude-dev-suite★ 51 звезда на GitHubОб этом скилле
Flyway Database Migrations
Deep Knowledge: Use
mcp__documentation__fetch_docswith technology:flywayfor comprehensive documentation.
Maven Configuration
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-database-postgresql</artifactId>
</dependency>
<plugin>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-maven-plugin</artifactId>
<version>${flyway.version}</version>
<configuration>
<url>jdbc:postgresql://localhost:5432/mydb</url>
<user>myuser</user>
<password>mypass</password>
</configuration>
</plugin>
Application Configuration
spring:
flyway:
enabled: true
baseline-on-migrate: true
locations: classpath:db/migration
validate-on-migrate: true
out-of-order: false
clean-disabled: true # Prevent clean in production!
Migration Naming Convention
V{version}__{description}.sql # Versioned migrations
U{version}__{description}.sql # Undo migrations (Teams/Enterprise)
R__{description}.sql # Repeatable migrations
Examples:
V1__create_users_table.sqlV1.1__add_email_index.sqlV2__create_departments_table.sqlR__create_views.sql
Initial Schema Migration
-- V1__init_schema.sql
-- Users table
CREATE TABLE users (
id BIGSERIAL PRIMARY KEY,
name VARCHAR(100) NOT NULL,
email VARCHAR(255) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL,
role VARCHAR(20) NOT NULL DEFAULT 'USER',
status VARCHAR(20) NOT NULL DEFAULT 'ACTIVE',
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP,
created_by VARCHAR(255),
updated_by VARCHAR(255)
);
CREATE INDEX idx_users_email ON users(email);
CREATE INDEX idx_users_status ON users(status);
CREATE INDEX idx_users_role ON users(role);
-- Roles table
CREATE TABLE roles (
id BIGSERIAL PRIMARY KEY,
name VARCHAR(50) NOT NULL UNIQUE,
description VARCHAR(255)
);
-- Insert default roles
INSERT INTO roles (name, description) VALUES
('ADMIN', 'System administrator'),
('MANAGER', 'Department manager'),
('USER', 'Regular user');
Add Column Migration
-- V2__add_phone_to_users.sql
ALTER TABLE users
ADD COLUMN phone VARCHAR(20);
CREATE INDEX idx_users_phone ON users(phone);
Add Foreign Key Migration
-- V3__create_departments.sql
CREATE TABLE departments (
id BIGSERIAL PRIMARY KEY,
name VARCHAR(100) NOT NULL UNIQUE,
code VARCHAR(10) NOT NULL UNIQUE,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
ALTER TABLE users
ADD COLUMN department_id BIGINT;
ALTER TABLE users
ADD CONSTRAINT fk_users_department
FOREIGN KEY (department_id) REFERENCES departments(id);
CREATE INDEX idx_users_department ON users(department_id);
Data Migration
-- V4__migrate_legacy_data.sql
-- Update existing data
UPDATE users
SET role = 'USER'
WHERE role IS NULL;
-- Migrate data from legacy format
INSERT INTO departments (name, code)
SELECT DISTINCT department_name, UPPER(SUBSTRING(department_name, 1, 3))
FROM legacy_employees
WHERE department_name IS NOT NULL;
Repeatable Migration (Views)
-- R__create_user_summary_view.sql
DROP VIEW IF EXISTS user_summary;
CREATE VIEW user_summary AS
SELECT
u.id,
u.name,
u.email,
u.role,
u.status,
d.name AS department_name,
u.created_at
FROM users u
LEFT JOIN departments d ON u.department_id = d.id;
Java-based Migration
@Component
public class V5__ComplexDataMigration implements JavaMigration {
@Override
public void migrate(Context context) throws Exception {
try (Statement stmt = context.getConnection().createStatement()) {
// Complex migration logic
ResultSet rs = stmt.executeQuery("SELECT id, data FROM legacy_table");
while (rs.next()) {
// Process and migrate data
}
}
}
@Override
public Integer getChecksum() { return null; }
@Override
public MigrationVersion getVersion() {
return MigrationVersion.fromVersion("5");
}
@Override
public String getDescription() {
return "Complex data migration";
}
}
Callback for Logging
@Component
public class FlywayCallback implements Callback {
private static final Logger log = LoggerFactory.getLogger(FlywayCallback.class);
@Override
public boolean supports(Event event, Context context) {
return event == Event.AFTER_EACH_MIGRATE ||
event == Event.AFTER_MIGRATE_ERROR;
}
@Override
public boolean canHandleInTransaction(Event event, Context context) {
return true;
}
@Override
public void handle(Event event, Context context) {
if (event == Event.AFTER_EACH_MIGRATE) {
MigrationInfo info = context.get
Установить flyway в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepGlobWriteEditFAQ
Что делает скилл flyway?
Flyway database migrations for Spring Boot applications. Covers migration scripts, versioning, callbacks, and rollback strategies. Based on production patterns from castellino and gestionale-presenze projects. USE WHEN: user mentions "flyway", "database versioning", "Java migrations", "Spring Boot migrations", "V1__", "migration checksum" DO NOT USE FOR: general migration strategies - use `migrations` instead, Liquibase - use specific tool skill, Prisma/TypeORM - use respective skills
Как установить скилл flyway?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл flyway запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic