Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: migratemgr8/mgr8
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.1.5
Choose a base ref
...
head repository: migratemgr8/mgr8
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Apr 14, 2022

  1. add schema

    alexandremr01 committed Apr 14, 2022
    Copy the full SHA
    3cc602f View commit details

Commits on Apr 16, 2022

  1. Created .mgr8config logic

    JorgeHohhe committed Apr 16, 2022
    Copy the full SHA
    b24ab3a View commit details
  2. Copy the full SHA
    ed33af5 View commit details
  3. Getting hash from Sql file

    JorgeHohhe committed Apr 16, 2022
    Copy the full SHA
    342c4d6 View commit details
  4. Copy the full SHA
    75a1a82 View commit details
  5. Copy the full SHA
    daa052d View commit details

Commits on Apr 19, 2022

  1. add postgres parsing

    alexandremr01 committed Apr 19, 2022
    Copy the full SHA
    b1b7243 View commit details
  2. detect views

    alexandremr01 committed Apr 19, 2022
    Copy the full SHA
    f239501 View commit details
  3. Copy the full SHA
    8893da6 View commit details
  4. rename view

    alexandremr01 committed Apr 19, 2022
    Copy the full SHA
    d59eb1a View commit details

Commits on Apr 20, 2022

  1. Update drivers/postgres/parser.go

    Co-authored-by: Davi Muniz <63565370+davimnz@users.noreply.github.com>
    alexandremr01 and davimnz authored Apr 20, 2022
    Copy the full SHA
    7c26503 View commit details
  2. Merge pull request #2 from kenji-yamane/feat/add-schema

    Feature add schema
    davimnz authored Apr 20, 2022
    Copy the full SHA
    82a3474 View commit details
  3. Fix release

    davimnz committed Apr 20, 2022
    Copy the full SHA
    0b9d9e6 View commit details
  4. Fix go releaser

    davimnz committed Apr 20, 2022
    Copy the full SHA
    ebfa7d6 View commit details
  5. fix yaml

    alexandremr01 committed Apr 20, 2022
    Copy the full SHA
    03d4899 View commit details
  6. add targets

    alexandremr01 committed Apr 20, 2022
    Copy the full SHA
    2305fd3 View commit details
  7. add build step

    alexandremr01 committed Apr 20, 2022
    Copy the full SHA
    61d9c3d View commit details
  8. fix yaml

    alexandremr01 committed Apr 20, 2022
    Copy the full SHA
    e7f8345 View commit details
  9. remove linux 386

    alexandremr01 committed Apr 20, 2022
    Copy the full SHA
    6a0421e View commit details
  10. Copy the full SHA
    2e6b47d View commit details
  11. fix typo

    atedesch1 committed Apr 20, 2022
    Copy the full SHA
    dbb3112 View commit details
  12. Merge pull request #3 from kenji-yamane/fix-makefile

    [Fix] Fix makefile
    alexandremr01 authored Apr 20, 2022
    Copy the full SHA
    cf958f6 View commit details

Commits on Apr 23, 2022

  1. Copy the full SHA
    ceec241 View commit details
  2. Copy the full SHA
    3ccbee8 View commit details

Commits on Apr 25, 2022

  1. Copy the full SHA
    0553d34 View commit details

Commits on Apr 26, 2022

  1. fix docker compose

    yuri-gama committed Apr 26, 2022
    Copy the full SHA
    71a029d View commit details
  2. Copy the full SHA
    3641271 View commit details
  3. Copy the full SHA
    bf99c11 View commit details
  4. add domain driver type

    kenji-yamane committed Apr 26, 2022
    Copy the full SHA
    e05d0a9 View commit details
  5. Copy the full SHA
    eb248fb View commit details
  6. Copy the full SHA
    ac68d8f View commit details
  7. update readme

    kenji-yamane committed Apr 26, 2022
    Copy the full SHA
    bb8d349 View commit details
  8. Copy the full SHA
    e11dcfc View commit details

Commits on Apr 27, 2022

  1. Merge pull request #5 from kenji-yamane/feat/mysql-parser

    Feat/mysql parser
    yuri-gama authored Apr 27, 2022
    Copy the full SHA
    933ea47 View commit details

Commits on Apr 28, 2022

  1. Copy the full SHA
    e86800f View commit details

Commits on Apr 29, 2022

  1. Copy the full SHA
    4022f1c View commit details
  2. Validation cmd

    kowalks committed Apr 29, 2022
    Copy the full SHA
    ed6e8c6 View commit details
  3. Added validation to apply cmd

    kowalks committed Apr 29, 2022
    Copy the full SHA
    124028f View commit details

Commits on Apr 30, 2022

  1. Copy the full SHA
    f2bb35e View commit details
  2. Copy the full SHA
    12e3ce1 View commit details
  3. Copy the full SHA
    b2b2cf7 View commit details
  4. add view statement parse

    kenji-yamane committed Apr 30, 2022
    Copy the full SHA
    4ff9543 View commit details
  5. add tests

    kenji-yamane committed Apr 30, 2022
    Copy the full SHA
    de61ee0 View commit details
  6. fix tests

    kenji-yamane committed Apr 30, 2022
    Copy the full SHA
    a13c020 View commit details

Commits on May 11, 2022

  1. Merge pull request #6 from kenji-yamane/feat/hash-validation

    Feat/hash validation
    alexandremr01 authored May 11, 2022
    Copy the full SHA
    25191b5 View commit details
  2. Merge pull request #7 from kenji-yamane/feat/add-mysql-parser

    Feat/add mysql parser
    alexandremr01 authored May 11, 2022
    Copy the full SHA
    88e05e7 View commit details
  3. Copy the full SHA
    6e8dc96 View commit details

Commits on May 12, 2022

  1. Merge pull request #8 from kenji-yamane/feat/add-asdf-and-detached-ex…

    …planation-to-readme
    
    add asdf and detached explanation to README
    davimnz authored May 12, 2022
    Copy the full SHA
    365866f View commit details
  2. Copy the full SHA
    e824ee8 View commit details

Commits on May 13, 2022

  1. Merge pull request #10 from kenji-yamane/better-readme

    [Improvement] Improve README
    alexandremr01 authored May 13, 2022
    Copy the full SHA
    50068b7 View commit details
Showing with 6,918 additions and 221 deletions.
  1. +13 −0 .github/codecov.yml
  2. +17 −10 .github/workflows/pr.yml
  3. +92 −10 .github/workflows/release.yml
  4. +0 −71 .github/workflows/tag.yml
  5. +8 −1 .gitignore
  6. +47 −0 .goreleaser.yaml
  7. +23 −0 Dockerfile
  8. +69 −1 Makefile
  9. +111 −14 README.md
  10. +16 −0 applications/application_suite_test.go
  11. +41 −0 applications/check.go
  12. +46 −0 applications/check_test.go
  13. +197 −0 applications/config.go
  14. +32 −0 applications/empty.go
  15. +49 −0 applications/empty_test.go
  16. +71 −0 applications/generate.go
  17. +66 −0 applications/generate_test.go
  18. +30 −0 applications/hashing.go
  19. +48 −0 applications/hashing_test.go
  20. +31 −0 applications/init.go
  21. +74 −0 applications/init_test.go
  22. +51 −0 applications/migration_helpers.go
  23. +105 −0 applications/migration_helpers_test.go
  24. +78 −0 applications/migrationscripts.go
  25. +167 −0 applications/migrationscripts_test.go
  26. +240 −58 cmd/apply.go
  27. +111 −0 cmd/apply_test.go
  28. +32 −0 cmd/check.go
  29. +71 −0 cmd/command.go
  30. +89 −0 cmd/command_suite_test.go
  31. +39 −0 cmd/diff.go
  32. +33 −0 cmd/empty.go
  33. +0 −1 cmd/generate.go
  34. +29 −0 cmd/init.go
  35. +66 −9 cmd/root.go
  36. +68 −0 cmd/validate.go
  37. +9 −1 docker-compose.yml
  38. +92 −0 domain/column_diff.go
  39. +128 −0 domain/column_diff_test.go
  40. +6 −0 domain/constants.go
  41. +69 −0 domain/diff.go
  42. +31 −0 domain/diff_deque.go
  43. +100 −0 domain/diff_test.go
  44. +16 −0 domain/domain_suite_test.go
  45. +44 −0 domain/driver.go
  46. +22 −0 domain/schema.go
  47. +33 −0 domain/table_diff.go
  48. +76 −0 domain/table_diff_test.go
  49. +10 −15 drivers/drivers.go
  50. +80 −0 drivers/mysql/deparser.go
  51. +16 −0 drivers/mysql/mysql_suite_test.go
  52. +135 −0 drivers/mysql/mysql_test.go
  53. +304 −0 drivers/mysql/parser.go
  54. +115 −0 drivers/postgres/deparser.go
  55. +233 −25 drivers/postgres/parser.go
  56. +16 −0 drivers/postgres/postgres_suite_test.go
  57. +200 −0 drivers/postgres/postgres_test.go
  58. +6 −0 global/constants.go
  59. +35 −0 global/database.go
  60. +39 −0 global/database_test.go
  61. +84 −1 go.mod
  62. +1,229 −2 go.sum
  63. +17 −0 infrastructure/clock.go
  64. +84 −0 infrastructure/file.go
  65. +96 −0 infrastructure/logger.go
  66. +1 −1 main.go
  67. +1 −0 migrations/0001_test_migration.down.sql
  68. 0 migrations/{0001_test_migration.sql → 0001_test_migration.up.sql}
  69. +2 −0 migrations/0002_test_migration.down.sql
  70. +0 −1 migrations/0002_test_migration.sql
  71. +4 −0 migrations/0002_test_migration.up.sql
  72. +1 −0 migrations/0003_test_migration.down.sql
  73. +1 −0 migrations/0003_test_migration.up.sql
  74. +82 −0 mock/applications/log_mock.go
  75. +116 −0 mock/applications/migrationscripts_mock.go
  76. +428 −0 mock/domain/driver_mock.go
  77. +49 −0 mock/infrastructure/clock_mock.go
  78. +93 −0 mock/infrastructure/file_mock.go
  79. +8 −0 testing/databaseconfig.go
  80. +42 −0 testing/databaseconfigs/mysql.go
  81. +45 −0 testing/databaseconfigs/postgres.go
  82. +88 −0 testing/dockermanager.go
  83. +63 −0 testing/dockermanager_test.go
  84. +41 −0 testing/fixtures/fixtures.go
  85. +112 −0 testing/fixtures/migrations_fixture.go
  86. 0 testing/testdata/0000_schema.sql
  87. +12 −0 testing/testdata/0001_schema.sql
  88. +6 −0 testing/testdata/0002_schema.sql
  89. +1 −0 testing/testdata/output/0001_1656197671.down.sql
  90. +6 −0 testing/testdata/output/0001_1656197671.up.sql
  91. +6 −0 testing/testdata/output/0002_1656197676.down.sql
  92. +9 −0 testing/testdata/output/0002_1656197676.up.sql
  93. +116 −0 testing/testdriver.go
13 changes: 13 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
coverage:
status:
patch: off
project:
default:
target: auto # auto will use the coverage from the base commit (pull request base or parent commit) coverage to compare against.
threshold: 0%
comment: # this is a top-level key
layout: "reach, diff, flags, files"
behavior: default
require_changes: false # if true: only post the comment if coverage changes
require_base: no # [yes :: must have a base report to post]
require_head: yes # [yes :: must have a head report to post]
27 changes: 17 additions & 10 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
name: pr
name: Pull Request Tests

on: [pull_request]
on:
pull_request:
types: [opened, reopened, synchronize]

jobs:
build-and-test:
build:
runs-on: ubuntu-latest
name: Build & Test

steps:
- uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: '1.17.6'

- name: Build
run: go build -v ./...
run: make build

- name: Test
run: go test -v ./...
- name: Run tests
run: make check
- name: Upload coverage reports to Codecov with GitHub Action
run: |
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
./codecov -t ${CODECOV_TOKEN} -f coverage.txt -F unit
./codecov -t ${CODECOV_TOKEN} -f integration_coverage.txt -F integration
102 changes: 92 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,70 @@
name: release
name: Release

on:
push:
tags:
- v*
branches:
- master

jobs:
build-and-test:
runs-on: ubuntu-latest
name: Build & Test

steps:
- uses: actions/checkout@v2
with:
go-version: '1.17.6'

- name: Build
run: make build

- name: Run tests
run: make check

- name: Upload coverage reports to Codecov with GitHub Action
run: |
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
./codecov -t ${CODECOV_TOKEN} -f coverage.txt -F unit
./codecov -t ${CODECOV_TOKEN} -f integration_coverage.txt -F integration
tag:
runs-on: ubuntu-latest
needs: build-and-test
name: Generate & Push Tag

outputs:
tag: ${{ steps.tag_generator.outputs.version_tag }}

steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Generate tag
id: tag_generator
uses: paulhatch/semantic-version@v4.0.2
with:
tag_prefix: 'v'
major_pattern: '(MAJOR)'
minor_pattern: '(MINOR)'
format: '${major}.${minor}.${patch}'
short_tags: false
bump_each_commit: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Push tag to github
run: |
git tag ${{ steps.tag_generator.outputs.version_tag }}
git push origin --tags
release:
runs-on: ubuntu-latest
needs: tag
name: Release

steps:
- name: Checkout
uses: actions/checkout@v2
@@ -19,11 +76,36 @@ jobs:
with:
go-version: '^1.17.6'

- name: Set up release environment
run: |-
echo 'GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}' >> .release-env
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: make release

deploy-docker:
runs-on: ubuntu-latest
needs: tag
name: Deploy to DockerHub

env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_TAG_LATEST_RELEASE: '${{ secrets.DOCKER_USER }}/mgr8:latest'
DOCKER_TAG_RELEASE: '${{ secrets.DOCKER_USER }}/mgr8:${{ needs.tag.outputs.tag }}'

steps:
- uses: actions/checkout@v2

- name: Docker login
run: |
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
- name: Build Docker image
run: |
docker build . --file Dockerfile --tag $DOCKER_TAG_LATEST_RELEASE --tag $DOCKER_TAG_RELEASE
- name: Push to DockerHub
run: |
docker push $DOCKER_TAG_RELEASE
docker push $DOCKER_TAG_LATEST_RELEASE
71 changes: 0 additions & 71 deletions .github/workflows/tag.yml

This file was deleted.

9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
bin/
.idea
.vscode
.vscode
coverage.txt
integration_coverage.txt

dist
.release-env
unit_coverage.out
.mgr8
47 changes: 47 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
builds:
- id: darwin-amd64
main: ./
binary: golang-cross
goos:
- darwin
goarch:
- amd64
env:
- PKG_CONFIG_SYSROOT_DIR=/sysroot/macos/amd64
- PKG_CONFIG_PATH=/sysroot/macos/amd64/usr/local/lib/pkgconfig
- CC=o64-clang
- CXX=o64-clang++
flags:
- -mod=readonly
ldflags:
- -s -w -X main.version={{.Version}}
- id: darwin-arm64
main: ./
binary: golang-cross
goos:
- darwin
goarch:
- arm64
env:
- CC=oa64-clang
- CXX=oa64-clang++
- id: linux-amd64
main: ./
binary: golang-cross
goos:
- linux
goarch:
- amd64
env:
- CC=gcc
- CXX=g++
- id: linux-arm64
main: ./
binary: golang-cross
goos:
- linux
goarch:
- arm64
env:
- CC=aarch64-linux-gnu-gcc
- CXX=aarch64-linux-gnu-g++
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM golang:1.17-alpine3.15 AS builder

RUN apk add --no-cache git gcc musl-dev make

WORKDIR /go/src/github.com/migratemgr8/mgr8

ENV GO111MODULE=on

COPY go.mod go.sum ./

RUN go mod download

COPY . ./

RUN make build

FROM alpine:3.15

COPY --from=builder /go/src/github.com/migratemgr8/mgr8/bin/mgr8 /usr/local/bin/mgr8
RUN ln -s /usr/local/bin/mgr8 /mgr8

ENTRYPOINT ["mgr8"]
CMD ["--help"]
Loading