انتقل إلى المحتوى
أمين أبوزيد
درس مخطط لهJNR-033-L02

أساسيات Flyway

  • الدرس 2 من 6
  • Junior
في هذا الدرس 4 موضوعات

هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.

نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.

في هذا الدرس

run versioned migrations at startup.

الموضوعات المخطط لها

  • Add flyway-core (and the PostgreSQL module if your Flyway version needs it: verify version before recording).
  • Place files in src/main/resources/db/migration named V1__baseline.sql, V2__add_sku.sql (two underscores).
  • At startup Flyway applies pending files and records them in flyway_schema_history with a checksum.
  • Changing an applied file changes its checksum, and startup fails.
  • For an existing database use baseline (baseline-on-migrate, with a baseline version) to mark what already exists.
تفاصيل المخطط المبدئي

عرض عملي

sql
-- V1__baseline.sql
create table category (id bigint generated always as identity primary key, name text not null);
create table product (
  id bigint generated always as identity primary key,
  name text not null,
  price numeric(12,2) not null,
  category_id bigint references category(id));

اختبر فهمك

Where does Flyway store what it has applied?

أظهر الإجابة

In the flyway_schema_history table.

التطبيق

طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.

المختبر والتمارين الاختبار

تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.

اكتب للبحث في المستويات والمراحل والوحدات والدروس.