Skip to content

Commit c78aaea

Browse files
committed
Adding fullstops
1 parent 6b1873b commit c78aaea

5 files changed

Lines changed: 117 additions & 117 deletions

File tree

docs/columns.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -77,67 +77,67 @@ All column classes support a fluent API with these methods:
7777
### Required Methods
7878

7979
```php
80-
// Set the column name
80+
// Set the column name.
8181
$column = new Integer_Column( 'user_id' );
8282
```
8383

8484
### Type Configuration
8585

8686
```php
87-
// Set the MySQL column type
87+
// Set the MySQL column type.
8888
->set_type( Column_Types::INT )
8989

90-
// Set the length/size
90+
// Set the length/size.
9191
->set_length( 11 )
9292

93-
// Set precision for float columns (decimal places)
94-
->set_precision( 2 ) // For DECIMAL(10,2)
93+
// Set precision for float columns (decimal places).
94+
->set_precision( 2 ) // For DECIMAL(10,2).
9595
```
9696

9797
### Nullability and Defaults
9898

9999
```php
100-
// Allow NULL values (default is NOT NULL)
100+
// Allow NULL values (default is NOT NULL).
101101
->set_nullable( true )
102102

103-
// Set a default value
103+
// Set a default value.
104104
->set_default( 0 )
105105
->set_default( 'pending' )
106-
->set_default( 'CURRENT_TIMESTAMP' ) // MySQL function
106+
->set_default( 'CURRENT_TIMESTAMP' ) // MySQL function.
107107
```
108108

109109
### Signing (Integer/Float only)
110110

111111
```php
112-
// Set signed/unsigned (default varies by type)
113-
->set_signed( false ) // UNSIGNED
114-
->set_signed( true ) // SIGNED
112+
// Set signed/unsigned (default varies by type).
113+
->set_signed( false ) // UNSIGNED.
114+
->set_signed( true ) // SIGNED.
115115
```
116116

117117
### Auto Increment (Integer only)
118118

119119
```php
120-
// Enable auto-increment
120+
// Enable auto-increment.
121121
->set_auto_increment( true )
122122
```
123123

124124
### Indexes
125125

126126
```php
127-
// Mark column as indexed
127+
// Mark column as indexed.
128128
->set_is_index( true )
129129

130-
// Mark column as unique
130+
// Mark column as unique.
131131
->set_is_unique( true )
132132

133-
// Mark column as primary key
133+
// Mark column as primary key.
134134
->set_is_primary( true )
135135
```
136136

137137
### Searchability
138138

139139
```php
140-
// Mark column as searchable (used by query methods)
140+
// Mark column as searchable (used by query methods).
141141
->set_searchable( true )
142142
```
143143

@@ -254,17 +254,17 @@ public static function get_schema_history(): array {
254254
'1.0.0' => function() use ( $table_name ) {
255255
$columns = new Column_Collection();
256256

257-
// Primary key
257+
// Primary key.
258258
$columns[] = ( new ID( 'id' ) )
259259
->set_length( 11 )
260260
->set_auto_increment( true );
261261

262-
// Foreign key
262+
// Foreign key.
263263
$columns[] = ( new Referenced_ID( 'user_id' ) )
264264
->set_length( 11 )
265265
->set_type( Column_Types::BIGINT );
266266

267-
// String fields
267+
// String fields.
268268
$columns[] = ( new String_Column( 'title' ) )
269269
->set_type( Column_Types::VARCHAR )
270270
->set_length( 255 )
@@ -276,12 +276,12 @@ public static function get_schema_history(): array {
276276
->set_default( 'draft' )
277277
->set_is_index( true );
278278

279-
// Text field
279+
// Text field.
280280
$columns[] = ( new Text_Column( 'content' ) )
281281
->set_type( Column_Types::LONGTEXT )
282282
->set_searchable( true );
283283

284-
// Numeric fields
284+
// Numeric fields.
285285
$columns[] = ( new Integer_Column( 'views' ) )
286286
->set_type( Column_Types::INT )
287287
->set_default( 0 );
@@ -292,11 +292,11 @@ public static function get_schema_history(): array {
292292
->set_precision( 2 )
293293
->set_default( 0.00 );
294294

295-
// Boolean
295+
// Boolean.
296296
$columns[] = ( new Boolean_Column( 'is_published' ) )
297297
->set_default( false );
298298

299-
// Timestamps
299+
// Timestamps.
300300
$columns[] = new Created_At( 'created_at' );
301301
$columns[] = new Updated_At( 'updated_at' );
302302

docs/indexes.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ Defines the primary key for the table. Primary keys uniquely identify each row a
1111
```php
1212
use StellarWP\Schema\Indexes\Primary_Key;
1313

14-
// Single column primary key
14+
// Single column primary key.
1515
$indexes[] = new Primary_Key( [ 'id' ] );
1616

17-
// Composite primary key
17+
// Composite primary key.
1818
$indexes[] = new Primary_Key( [ 'event_id', 'ticket_id' ] );
1919
```
2020

@@ -25,10 +25,10 @@ Ensures that all values in the indexed columns are unique across the table.
2525
```php
2626
use StellarWP\Schema\Indexes\Unique_Key;
2727

28-
// Single column unique constraint
28+
// Single column unique constraint.
2929
$indexes[] = new Unique_Key( [ 'email' ] );
3030

31-
// Composite unique constraint
31+
// Composite unique constraint.
3232
$indexes[] = new Unique_Key( [ 'user_id', 'event_id' ] );
3333
```
3434

@@ -39,10 +39,10 @@ A standard index that speeds up lookups on the specified columns. Does not enfor
3939
```php
4040
use StellarWP\Schema\Indexes\Classic_Index;
4141

42-
// Single column index
42+
// Single column index.
4343
$indexes[] = new Classic_Index( [ 'status' ] );
4444

45-
// Composite index
45+
// Composite index.
4646
$indexes[] = new Classic_Index( [ 'user_id', 'created_at' ] );
4747
```
4848

@@ -53,10 +53,10 @@ Enables full-text searching on text columns. Useful for content search functiona
5353
```php
5454
use StellarWP\Schema\Indexes\Fulltext_Index;
5555

56-
// Single column fulltext
56+
// Single column fulltext.
5757
$indexes[] = new Fulltext_Index( [ 'content' ] );
5858

59-
// Multiple columns fulltext
59+
// Multiple columns fulltext.
6060
$indexes[] = new Fulltext_Index( [ 'title', 'content', 'excerpt' ] );
6161
```
6262

@@ -103,10 +103,10 @@ The library automatically generates index names based on the index type and colu
103103
All index types support multiple columns (composite indexes):
104104

105105
```php
106-
// Composite classic index
106+
// Composite classic index.
107107
$indexes[] = new Classic_Index( [ 'user_id', 'status', 'created_at' ] );
108108

109-
// Composite unique key
109+
// Composite unique key.
110110
$indexes[] = new Unique_Key( [ 'external_id', 'source' ] );
111111
```
112112

@@ -145,22 +145,22 @@ public static function get_schema_history(): array {
145145

146146
$columns[] = new Created_At( 'created_at' );
147147

148-
// Indexes for common queries
148+
// Indexes for common queries.
149149
$indexes = new Index_Collection();
150150

151-
// Unique order numbers
151+
// Unique order numbers.
152152
$indexes[] = new Unique_Key( [ 'order_number' ] );
153153

154-
// Fast lookups by customer
154+
// Fast lookups by customer.
155155
$indexes[] = new Classic_Index( [ 'customer_id' ] );
156156

157-
// Fast lookups by status
157+
// Fast lookups by status.
158158
$indexes[] = new Classic_Index( [ 'status' ] );
159159

160-
// Efficient date range queries
160+
// Efficient date range queries.
161161
$indexes[] = new Classic_Index( [ 'created_at' ] );
162162

163-
// Composite index for customer orders by status
163+
// Composite index for customer orders by status.
164164
$indexes[] = new Classic_Index( [ 'customer_id', 'status' ] );
165165

166166
return new Table_Schema( $table_name, $columns, $indexes );
@@ -199,13 +199,13 @@ public static function get_schema_history(): array {
199199

200200
$indexes = new Index_Collection();
201201

202-
// Unique slugs for URL routing
202+
// Unique slugs for URL routing.
203203
$indexes[] = new Unique_Key( [ 'slug' ] );
204204

205-
// Full-text search on title and content
205+
// Full-text search on title and content.
206206
$indexes[] = new Fulltext_Index( [ 'title', 'content' ] );
207207

208-
// Fast filtering by status
208+
// Fast filtering by status.
209209
$indexes[] = new Classic_Index( [ 'status' ] );
210210

211211
return new Table_Schema( $table_name, $columns, $indexes );
@@ -224,7 +224,7 @@ public static function get_schema_history(): array {
224224
'1.0.0' => function() use ( $table_name ) {
225225
$columns = new Column_Collection();
226226

227-
// Using session_id as primary key (not auto-increment)
227+
// Using session_id as primary key (not auto-increment).
228228
$columns[] = ( new String_Column( 'session_id' ) )
229229
->set_type( Column_Types::VARCHAR )
230230
->set_length( 128 );
@@ -241,13 +241,13 @@ public static function get_schema_history(): array {
241241

242242
$indexes = new Index_Collection();
243243

244-
// String-based primary key
244+
// String-based primary key.
245245
$indexes[] = new Primary_Key( [ 'session_id' ] );
246246

247-
// Lookup sessions by user
247+
// Lookup sessions by user.
248248
$indexes[] = new Classic_Index( [ 'user_id' ] );
249249

250-
// Efficiently clean up expired sessions
250+
// Efficiently clean up expired sessions.
251251
$indexes[] = new Classic_Index( [ 'expires_at' ] );
252252

253253
return new Table_Schema( $table_name, $columns, $indexes );
@@ -276,10 +276,10 @@ public static function get_schema_history(): array {
276276

277277
$indexes = new Index_Collection();
278278

279-
// Composite primary key (no auto-increment needed)
279+
// Composite primary key (no auto-increment needed).
280280
$indexes[] = new Primary_Key( [ 'event_id', 'venue_id' ] );
281281

282-
// Fast reverse lookups
282+
// Fast reverse lookups.
283283
$indexes[] = new Classic_Index( [ 'venue_id' ] );
284284

285285
return new Table_Schema( $table_name, $columns, $indexes );
@@ -313,11 +313,11 @@ public static function get_schema_history(): array {
313313
3. **Cover common queries**: Design indexes around your most frequent query patterns
314314

315315
```php
316-
// Good: User queries often filter by status first, then date
316+
// Good: User queries often filter by status first, then date.
317317
$indexes[] = new Classic_Index( [ 'status', 'created_at' ] );
318318

319-
// Also good: Allows queries on just 'status' OR 'status' + 'created_at'
320-
// MySQL can use the leftmost prefix
319+
// Also good: Allows queries on just 'status' OR 'status' + 'created_at'.
320+
// MySQL can use the leftmost prefix.
321321
```
322322

323323
### Performance Considerations
@@ -336,7 +336,7 @@ public static function get_schema_history(): array {
336336

337337
return [
338338
'1.0.0' => function() use ( $table_name ) {
339-
// Original schema
339+
// Original schema.
340340
$columns = new Column_Collection();
341341
$columns[] = ( new ID( 'id' ) )->set_auto_increment( true );
342342
$columns[] = ( new String_Column( 'email' ) )
@@ -346,7 +346,7 @@ public static function get_schema_history(): array {
346346
return new Table_Schema( $table_name, $columns );
347347
},
348348
'1.1.0' => function() use ( $table_name ) {
349-
// Add unique constraint on email in version 1.1.0
349+
// Add unique constraint on email in version 1.1.0.
350350
$columns = new Column_Collection();
351351
$columns[] = ( new ID( 'id' ) )->set_auto_increment( true );
352352
$columns[] = ( new String_Column( 'email' ) )

0 commit comments

Comments
 (0)