jaeyson/ex_typesense

add mix task for creation and import

jaeyson opened this issue · 0 comments

Adding mix task like mix phx.new as a convenience command when using shell, particularly when one is testing in localhost. Scope for the mix task will be the following:

  • creating collection, where it takes the name of module
  • alias pointing to the collection name
  • importing all records to the collection

E.g. we have a module called Person (persons table) where the collection name will be persons, then documents will be all records in the persons table. Ideally the mix task will look like:

mix typesense create --schema <MODULE_NAME>
mix typesense create --schema <MODULE_NAME> <CUSTOM_COLLECTION_NAME>
mix typesense create --alias <MODULE_NAME> <ALIAS>
mix typesense create --alias <COLLECTION_NAME> <ALIAS>
  • mix typesense create --schema App.Accounts.Person <-- where the schema name will be persons.
  • mix typesense create --schema App.Accounts.Person persons_dec_2023 <-- where persons_dec_2023 is the custom name linked to that module.
  • mix typesense create --alias persons_dec_2023 persons <-- where persons is the collection alias
  • mix typesense create --alias App.Accounts.Person persons_alias