mpociot / laravel-test-factory-helper

Generate Laravel test factories from your existing models
935 stars 87 forks source link

Postgres / sqlite support #50

Open perezale opened 4 years ago

perezale commented 4 years ago

is postgres or sqlite support available? Just tried both with no luck at 'SHOW COLUMNS... ' :cry:

If so, maybe there should be a message in README

jasonmccreary commented 4 years ago

I'll take a look as I plan to revisit the way these are loaded in the coming weeks.

mstaack commented 4 years ago

great news, just came across this issue.

@jasonmccreary Didn't do a deep dive into the code, but

DB::connection()->getDoctrineSchemaManager()->listTableColumns('users')

gives me the postgres columns via the optional doctrine/dbal package

result:

array:8 [
  "id" => Doctrine\DBAL\Schema\Column {#1305
    #_type: Doctrine\DBAL\Types\BigIntType {#1315}
    #_length: null
    #_precision: 10
    #_scale: 0
    #_unsigned: false
    #_fixed: false
    #_notnull: true
    #_default: null
    #_autoincrement: true
    #_platformOptions: []
    #_columnDefinition: null
    #_comment: null
    #_customSchemaOptions: []
    #_name: "id"
    #_namespace: null
    #_quoted: false
  }
  "name" => Doctrine\DBAL\Schema\Column {#1340
    #_type: Doctrine\DBAL\Types\StringType {#1335}
    #_length: 255
    #_precision: 10
    #_scale: 0
    #_unsigned: false
    #_fixed: false
    #_notnull: true
    #_default: null
    #_autoincrement: false
    #_platformOptions: []
    #_columnDefinition: null
    #_comment: null
    #_customSchemaOptions: []
    #_name: "name"
    #_namespace: null
    #_quoted: false
  }
....
Chingoski commented 4 years ago

Are there any updates on the support for postgres? I cant seem to get the package running for my postgers 9.6DB on laravel 6.10. Every time i run the command i get the same error "Could not analyse class []"

jasonmccreary commented 4 years ago

Haven't circled back. You're welcome to open a PR.

Chingoski commented 4 years ago

@jasonmccreary I have found a possible solution i will try to open an PR later this day or tomorrow.