Note that three keys have been added to the configuration array: read, write and sticky. After the database has been created, you may easily configure your environment variables to point to this database by placing the absolute path to the database in the DB_DATABASE environment variable: You can create a new SQLite database using the touch command in your terminal: touch database/database.sqlite. SQLite databases are contained within a single file on your filesystem. However, you are free to modify your database configuration as needed for your local database. Examples for most of Laravel's supported database systems are provided in this file.īy default, Laravel's sample environment configuration is ready to use with Laravel Sail, which is a Docker configuration for developing Laravel applications on your local machine. ![]() Most of the configuration options within this file are driven by the values of your application's environment variables. In this file, you may define all of your database connections, as well as specify which connection should be used by default. $table->dropUnique('users_email_unique') ĭrop a unique index from the "users" table.The configuration for Laravel's database services is located in your application's config/database.php configuration file. Here are some examples: Commandĭrop a primary key from the "users" table. Simply concatenate the table name, the name of the indexed column, and the index type. ![]() By default, Laravel automatically assigns a reasonable name to the indexes. To drop an index, you must specify the index's name. $table->unique('state', 'my_index_name') $table -> index ( ' email ', ' my_index_name ' ) Available Index Types Command For example, to make the column "nullable", you may use the nullable method: In addition to the column types listed above, there are several column "modifiers" you may use while adding a column to a database table. Unsigned TINYINT equivalent for the database. Unsigned SMALLINT equivalent for the database. Unsigned MEDIUMINT equivalent for the database. Unsigned INT equivalent for the database. Unsigned BIGINT equivalent for the database. TIMESTAMP (with timezone) equivalent for the database.Īdds nullable created_at and updated_at columns.Īdds nullable created_at and updated_at (with timezone) columns. TIME (with timezone) equivalent for the database. Incrementing ID (primary key) using a "UNSIGNED SMALL INTEGER" equivalent.Īdds nullable deleted_at column for soft deletes. Nullable versions of the timestamps() columns.Īdds remember_token as VARCHAR(100) NULL. Nullable versions of the morphs() columns. ![]() Incrementing ID (primary key) using a "UNSIGNED MEDIUM INTEGER" equivalent.Īdds unsigned INTEGER taggable_id and STRING taggable_type. Incrementing ID (primary key) using a "UNSIGNED INTEGER" equivalent. ![]() Incrementing ID (primary key) using a "UNSIGNED BIG INTEGER" equivalent.ĭATETIME (with timezone) equivalent for the database.ĭECIMAL equivalent with a precision and scale.ĭOUBLE equivalent with precision, 15 digits in total and 8 after the decimal point.įLOAT equivalent for the database, 8 digits in total and 2 after the decimal point. Of course, the schema builder contains a variety of column types that you may specify when building your tables: Command
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |