Use comments to show when fixtures were used

Aperta
#208 1 commento 4 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
postgresql, sql, typescript
Ambito
database, tooling

Direzione di ricerca

Traccia i punti di ingresso della traduzione dell’inclusione delle fixture e della migrazione utilizzando gli esempi current.sql, fixtures/functions/hello.sql e 000001.sql generato presenti nell’issue. Confronta l’output committato e quello non migrato, quindi verifica che l’SQL derivato dalla fixture sia contrassegnato da commenti che identificano la fixture inclusa e i suoi confini.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Feature description

In experimenting with the new fixture feature, I noticed that:

  1. There is no way to tell in the committed migration that a fixture was used.
  2. When uncommitting a migration that used a fixture, the fixture contents are inlined back into the migration

It seems like it would be useful to include some comments that indicate it came from a fixture. Maybe something like

current.sql:

select 'foo';
--! include functions/hello.sql

fixtures/functions/hello.sql

create or replace function public.hello() returns text as $$
  select 'Hello, world!';
$$ language sql;

translating into 000001.sql

--! Previous: -
--! Hash: sha1:a62f7d32702b880992ad9e2a7753dd977267064a

select 'foo';

--! Included: functions/hello.sql
create or replace function public.hello() returns text as $$
  select 'Hello, world!';
$$ language sql;
--! EndIncluded

I'm not deeply familiar with naming conventions of the !-- comments, so of course feel free to suggest better names

Motivating example

I was messing around with the new fixture features and was curious how it handled unmigrations. Admittedly, unmigrating is not a common thing I do, so it's not a huge deal. But as I thought about it, I came to think that even including a comment in the final migration that the statements came from a fixture is a positive addition to help future readers of migrations understand how the migrations were written.

Breaking changes

It seems like a change like this would only affect migrations going forward, so hopefully no breaking changes for anyone who is already on the 2.0 release candidates.

Supporting development

I:

  • am interested in building this feature myself
  • am interested in collaborating on building this feature
  • am willing to help testing this feature before it's released
  • am willing to write a test-driven test suite for this feature (before it exists)
  • am a Graphile sponsor ❤️ (Just at the "backer" level)
  • have an active support or consultancy contract with Graphile
Lingua principale
TypeScript
Stelle
836
Fork
71
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di graphile/migrate

Tutte le issue di graphile/migrate

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.