flagr icon indicating copy to clipboard operation
flagr copied to clipboard

[WIP] Add mssql support

Open zhouzhuojie opened this issue 4 years ago • 3 comments

Description

Fix https://github.com/checkr/flagr/issues/326

Motivation and Context

Add support for mssql

How Has This Been Tested?

Types of changes

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • [ ] My code follows the code style of this project.
  • [ ] My change requires a change to the documentation.
  • [ ] I have updated the documentation accordingly.
  • [ ] I have added tests to cover my changes.
  • [ ] All new and existing tests passed.

zhouzhuojie avatar Mar 17 '20 02:03 zhouzhuojie

Codecov Report

Merging #331 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #331   +/-   ##
=======================================
  Coverage   81.91%   81.91%           
=======================================
  Files          26       26           
  Lines        1537     1537           
=======================================
  Hits         1259     1259           
  Misses        209      209           
  Partials       69       69
Impacted Files Coverage Δ
pkg/entity/db.go 76.47% <ø> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f10c6a9...3ce9943. Read the comment docs.

codecov-io avatar Mar 17 '20 02:03 codecov-io

Hello and thanks for this quick response. I tried using your branch with an mssql database. However when i create a new flag the "updated_by" field is not populated. And when i try to edit the flag i get an error (see attachment). Untitled

Also the logs point to /go/src/github.com/checkr/flagr/pkg/handler/crud.go:150

thanks, can you help check anything special we need to do for column types and automigrate that may be specific to mssql?

It's a WIP, I think I may want to add some integration tests for mssql connection. Just like other DBs.

zhouzhuojie avatar Mar 19 '20 20:03 zhouzhuojie

So after a bit of trial and error I fixed the issues by doing the following:

  1. flag_snapshot.go: line 19: change of sql:"type:text" ---> sql:"type:varbinary(max)"
  2. flag.go: removal of .Order("id ASC") in func PreloadSegmentsVariants for both Segments and Variants

Akensy avatar Mar 19 '20 23:03 Akensy

Stale pull request message

github-actions[bot] avatar Aug 26 '22 21:08 github-actions[bot]